How can I avoid an out of memory error (correlation matrix too large) with a bivariate normal distribution?
2 views (last 30 days)
Show older comments
I am trying to create a bivariate normal distribution using MATLAB,
The two well known and easy methods are:
Y = mvnrnd(Mu , Sigma*CorrelationMatrix , Simulations);
or
Y = randn(Simulations,size)*chol(Sigma*CorrelationMatrix );
I am getting an out of memory message since the CM (CorrelationMatrix) is too large.
Attempts to solve the problem: (with no luck so far)
- I tried to do matrix partitioning, i.e. partition the CM into n*m blocks and using the following technique:
Y = randn(Simulations,size)*chol(Sigma*CorrelationMatrix );
However "chol" complains about CM not being a positive definite matrix, which makes sense.
- Using "sparse" I was able to push the size a bit up before getting the "Out of Memory" error,
- Using "single" instead of "double" seem to do better than "sparse" but it is still way far from the target size.
Is there any other way to handle large matrices problem?
0 Comments
Answers (1)
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!