Efficient multiplication of very large matrices in MATLAB

前端 未结 3 629
情深已故
情深已故 2020-12-05 20:28

I don\'t have enough memory to simply create a diagonal D-by-D matrix, since D is large. I keep getting an \'out of memory\' error.

Instead of performing M x D x D o

3条回答
  •  再見小時候
    2020-12-05 20:49

    1. You are getting "out of memory" because MATLAB can not find a chunk of memory large enough to accommodate the entire matrix. There are different techniques to avoid this error described in MATLAB documentation.

    2. In MATLAB you obviously do not need programming explicit loops in most cases because you can use operator *. There exists a technique how to speed up matrix multiplication if it is done with explicit loops, here is an example in C#. It has a good idea how (potentially large) matrix can be split into smaller matrices. To contain these smaller matrices in MATLAB you can use cell matrix. It is much more probably that system finds enough RAM to accommodate two smaller sub-matrices then the resulting large matrix.

提交回复
热议问题