forked from intellhave/SDRSAC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generateWeightMatrix.m
31 lines (26 loc) · 1.17 KB
/
generateWeightMatrix.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
% Generate weight matrix for the task of quadratic matching
function [W, acceptedPairs] = generateWeightMatrix(M, B, config)
N = size(M, 2);
W = -10000*ones(N*N, N*N);
acceptedPairs = 0;
% Loop through all possible pairs
for p=1:N
for q=1:N
for s=1:N
for t=1:N
if (p~=s && q~=t)
i = p + (q-1)*N;
j = s + (t-1)*N;
dDiff = abs( distance(M,p,s) - distance(B,q,t));
psDist = distance(M, p,s);
qtDist = distance(B, q,t);
if dDiff <= config.dDiffThresh && psDist >= config.pairDistThresh && qtDist >= config.pairDistThresh
W (i,j) = exp(-dDiff); % can also use 1./dDiff; %
acceptedPairs = acceptedPairs + 1;
end
end
end
end
end
end
end