0

Given two very big matrices in MATLAB, how can I multiply them in fast manner? The multiplication should be a matrix multiplication (not bitwise) therefore it seem using a function like bsxfun is NOT possible.

Example:

 A = rand(100000,50000) ;
 B = rand(50000,50000)  ;
 C = A* B %% takes too much time

DO you have any ideas?

Yas
  • 811
  • 4
  • 11
  • 20
  • 3
    That is the fastest you will ever get it. Native MATLAB matrix multiplication uses a modification of FORTRAN's LAPACK under the hood, which is already fast as it is after many years of research and optimization. There's a reason why the libraries are still used in FORTRAN, and this is it. There's also a reason why MATLAB is used for matrix manipulation, and this is it. – rayryeng Feb 19 '16 at 19:33
  • 2
    If you have some special structure on the matrices (symmetric, sparse, etc.) then there are options. For random matrices, @rayryeng spelled it out perfectly. – gariepy Feb 19 '16 at 20:29
  • Better hardware is also an option, especially if this is something you need to do often, or for a commercial or research purpose. – gariepy Feb 19 '16 at 20:31
  • Thanks alot for the supporting information – Yas Feb 19 '16 at 20:57

0 Answers0