Tricks to increase computational speed for D = (A + A*B).*C
Show older comments
Hello
I am working on computing the time evolution of a distribution. The distribution evolves as follows
g(t + dt) = (g(t) + dt*MAT*g(t)).*exp(-k*dt)
here g and k are column vector of size m*1, MAT is a square matrix of size m*m.
Say i have to evolve it "n" times, the way I have attempted my solution is
g = zeros(m,n)
g(:,1) = g0 % initalising
MAT, k = something pre calculated
for i = 1:1:n
g(:,i+1) = (g(:,i) + dt*MAT*g(:,i) ).*exp(-k*dt)
end
This is the conventional basic way I guess but it takes a long time. How else can I implement the evolution to make it faster.
For perspective the matrices are of the order of 10,000*10,000 and I would like to evolve it for another 5000 ish points
MAT is a mostly a sparse matrix. It has significant non zero diagonal elements and in a given row maybe 50-60 elements are non zero.
Grateful for any suggestions!
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics 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!