How to speed up the calculation of jacobian?
17 views (last 30 days)
Show older comments
Hi all,
I have a vector f with dimension 10000. I used jacobian(f,x) to compute its jacobian, but this turns out to be very slow. Is there any way that I can speed up or use parallel computation?
Many thanks.
8 Comments
Walter Roberson
on 13 Dec 2013
Try
parfor xi = 1 : length(x)
Jx(xi) = diff(f,x(xi));
end
Matt J
on 13 Dec 2013
Edited: Matt J
on 13 Dec 2013
I think computing the Jacobian for once would be the best choice.
Yes, but it's still not clear why you have to do that using Symbolic Toolbox functions. Why is it so hard to derive an expression for the Jacobian on your own? If you can, then it will be much faster to use that expression. For example, given
f=@(x) (x.^(1:N)).'
it would be much faster to compute Jacobian via
Jac=@(x) spdiags((1:N).*(x.^(0:N-1)),0,N,N);
then going through jacobian(f,x).
Answers (0)
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!