algorithm - Efficient way of generating "item-item distance rank matrix" in MATLAB? -


i have 1000-by-3 matrix x containing 1000 datapoints in 3d space. can generate item-item mahalanobis distance matrix in matlab:

x = random(1000, 3); distmat = pdist(x, 'mahalanobis'); distmat = squareform(distmat); 

where (i, j)-th entry distance between point i , point j.

now wish have similar matrix (i, j)-th entry rank of point i among points based on distance point j. call "item-item distance rank matrix."

my idea sort each row of distmat , construct desired matrix sorting indices, requires 1000 sorting operations. believe there's more efficient way.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -