0001
0002
0003 function [Search] = xMutualDiscrepancy(File,Search,Limit)
0004
0005 Query = Search.Query;
0006 Candidates = Search.Candidates;
0007
0008 N = Query.NumNT;
0009 [s,t] = size(Candidates);
0010
0011 if nargin > 2,
0012 s = min(s,Limit);
0013 end
0014
0015 if ~isfield(Query,'LocWeight'),
0016 Query.LocWeight = ones(1,N);
0017 end
0018
0019 if ~isfield(Query,'AngleWeight'),
0020 Query.AngleWeight = ones(1,N);
0021 end
0022
0023
0024
0025 if min(Search.DiscComputed(1,1:s)) == 0,
0026 for k=1:s,
0027 if Search.DiscComputed(k) == 0,
0028 f1 = Candidates(k,N+1);
0029 c1.NumNT = Query.NumNT;
0030 c1.NT = File(f1).NT(Candidates(k,1:N));
0031 c1.LocWeight = Query.LocWeight;
0032 c1.AngleWeight = Query.AngleWeight;
0033 c1.LDiscCutoff = Inf;
0034 c1 = xPrecomputeForDiscrepancy(c1);
0035
0036 for j=1:k-1,
0037 f2 = Candidates(j,N+1);
0038 c2 = File(f2).NT(Candidates(j,1:N));
0039 Search.Disc(j,k) = sqrt(xDiscrepancyFast(c1,c2))/Query.NumNT;
0040 Search.Disc(k,j) = Search.Disc(j,k);
0041 end
0042 Search.DiscComputed(k) = 1;
0043 end
0044 end
0045 end
0046