필터 지우기
필터 지우기

Speed up the pseudoinverse calculation

조회 수: 4 (최근 30일)
Vincent
Vincent 2015년 6월 18일
댓글: Vincent 2015년 6월 20일
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