1 function [i,j] = find_corresp(V1,V2)
2 %
function [i,j] = find_corresp(V1,V2)
4 % find identical columns in V1 and V2, i.e.
5 % V1(:,i(1)) = V2(:,j(1)) and all other indices in i,j
6 %
double occurences can happen
8 % Bernard Haasdonk 22.5.2007
15 cutsize = ceil(30000/n2);
16 ncuts = ceil(n1/cutsize);
18 ind1 = (1+(c-1)*cutsize):min(n1, c*cutsize);
20 mask = ones(length(ind1),n2);
21 for dim = 1:size(V1,1);
22 VV1 = repmat(V1(dim,ind1)',1,n2);
23 VV2 = repmat(V2(dim,:),length(ind1),1);
24 mask = mask & (VV1 == VV2);
26 [ipart,jpart] = find(mask);
28 i = [i; ipart(:)+(c-1)*cutsize];
32 %% for each column vector in the first matrix, the nearest neighbour
33 %% column in the second matrix is determined. such that
34 %% V(1) and V2(j(1)) are closest among all other V2 columns with
35 %% respect to l2-norm. The minimum distances are returned in dist
37 %% The routine is required for large vector sets, such that the
38 %% simply tensor-product approach by setting up complete distance
39 %% matrices is avoided.
41 %% Therefore, currently a stupid search is performed over all
44 %% Bernard Haasdonk 22.5.2007
51 % dist = sum((repmat(V1(:,i),1,n2)-V2).^2);
52 % [dmin, jmin] = min(dist);
53 % dmins(i) = sqrt(dmin(1));
57 % TO BE ADJUSTED TO NEW SYNTAX