Rank: 258324 based on 0 downloads (last 30 days) and 0 file submitted
Personal Profile:

Astrophysicist

Professional Interests:
Astrophysics, physics, computing

 

Watch this Author's files

 

Comments and Ratings by Daniel
Updated File Comments Rating
08 Jul 2013 Kabsch algorithm Find the rigid transformation & Least Root Mean Square distance between two paired sets of points Author: Ehud Schreiber

For large N most of the time is spent in the two for loops.
To remove them bsxfun is useful. Replace the lines in Kabsch.m:
------------------------------------
Pdm = zeros(D,N) ;
for i=1:N
Pdm(:,i) = m(i)*P(:,i) ;
end
C = Pdm*Q' ;
------------------------------------
by
------------------------------------
C = bsxfun(@times,m,P)*Q';
------------------------------------
and the lines
------------------------------------
lrms = 0 ;
for i=1:N
lrms = lrms + m(i)*Diff(:,i)'*Diff(:,i) ;
end
lrms = sqrt(lrms) ;
------------------------------------
by
------------------------------------
lrms = sqrt(sum(sum(bsxfun(@times,m,Diff).*Diff))) ;
------------------------------------
and the execution speed will be increased by ~70 for N=3'000'000

Contact us