Tricks to increase computational speed for D = (A + A*B).*C
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!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! 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! matrix manipulation, ode, speed MATLAB Answers — New Questions