pro donde,matrix,w,coor ;+ ; Finding the coordinates for every dimension of matrix that ; correspond to the 'global' coordinate w, as retrieved from 'where'. ; ; IN: matrix - fltarr Any number of dimensions. ; w - float 'global' coordinate, as provided by ; where. ; ; OUT: coor - intarr Coordinates of the point identified by ; the 'global' coordinate w. This vector ; has many elements as dimensions of ; matrix. ; ; C. Allende Prieto, UT, May 1999 ;- s=size(matrix) ndim=s(0) c=fltarr(ndim) coor=intarr(ndim) for i=1,ndim do begin c(i-1)=1. for k=1,i-1 do begin c(i-1)=c(i-1)*s(k) endfor endfor for i=ndim,1,-1 do begin sum=0.0 for k=i+1,ndim do begin sum=sum+c(k-1)*coor(k-1) endfor coor(i-1)=floor((w-sum)/c(i-1)) endfor end