How speed up symbolic matrix calculation?

1 view (last 30 days)
Moonsik Kim
Moonsik Kim on 26 Jul 2013
Hi, all
I try to calculate the following symbolic matrix('A').
A= s.'*(s.*repmat(census(:,6),1,k))-diag(sum(repmat(census(:,6),1,k).*s));
Here, s=438x611 Symbolic matrix, census=438x1 Numeric vector, k=611. And each element of matrix 's' is quite complicated because it includes exponential expression and division expression.
(Ultimately, I'll multiply 'A' and a vector(let's call it 'B'). And I'll differentiate the resulting vector('C=A*B') with respect to their parameters.)
I ran this code on Matlab. The problems are two things.
First, 'low memory' warning pops up and Matlab program is forced to end, even though I have 16G RAM. I checked windows task manager and found out that the above calculation used more than 16G memory. ---> What shall I do? Do I have to upgrade to 32G memory? Is there any other way to calculate 'A' which requires less memory?
Second, the calculation takes too long. It takes more than at least 2 hours. ---> Is there any faster way to calculate 'A'?
Could you help me? Thanks.
Thanks, Moonsik

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!