Speed up the pseudoinverse calculation

8 次查看(过去 30 天)
Hi,
I am looking for a way to decrease the computational time for some lines called thousands of times. The idea is to improve the computational speed of the calculation of the pseudoinverse (Jplus in the code). Do you think there is a faster way than using the svd decomposition in Matalb ? If you think its fun to try alternatives, you can give a shot (Enclosed is a save of the workspace with two mex functions). Just unzip the folder and run the code below (the mex-files will only work with 64bit Win platform. Sorry for that!! :))
for k=1:1500
markk=mark(:,k);
M=MR(1:3,markk,k,s)'; M=M(:);
markk3D=[markk;markk;markk];
a=1;er=1;
while mean(abs(er))>0.005 && a<6
T=Tags3M(qk,TS);
T=T(markk3D);
er=T-M;
J=TagsJacobian3M(qk,TS);
J=J(markk3D,:);
[U,S,V] = svd(J,0); r = size(S,1); SMin = S(r,r);
Jplus=V/S*U';
qk = qk - Jplus*er;
a=a+1;
end
end
Thank you for your valuable help!! And excuse me in advance for the late replies cause tomorrow is midsummer here in Sweden (working holiday)!!

回答(1 个)

Eric Lin
Eric Lin 2015-6-19
Depending on the dimensions of your matrices, applying the "0" or 'econ' argument to svd may speed up your calculation. SVD Documentation
This File Exchange submission claims to give a faster SVD calculation than the MATLAB implementation: Fast SVD
  1 个评论
Vincent
Vincent 2015-6-20
Thank you Eric. The eco calculation of the SVD is already included (see the code above). Thank you anyway for your time.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by