Home > FR3DSource > xRankCandidates.m

xRankCandidates

PURPOSE ^

xRankCandidates(File,Model,Candidates) calculates the discrepancy for

SYNOPSIS ^

function [Discrepancy, Candidates] = xRankCandidates(File,Model,Cand,Verbose)

DESCRIPTION ^

 xRankCandidates(File,Model,Candidates) calculates the discrepancy for
 each candidate

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % xRankCandidates(File,Model,Candidates) calculates the discrepancy for
0002 % each candidate
0003 
0004 function [Discrepancy, Candidates] = xRankCandidates(File,Model,Cand,Verbose)
0005 
0006 if nargin < 4,
0007   Verbose = 0;
0008 end
0009 
0010 if Verbose > 0,
0011   fprintf('Calculating discrepancy\n');
0012 end
0013 
0014 N = Model.NumNT;
0015 s = length(Cand(:,1));
0016 
0017 Discrepancy = zeros(65000,1);
0018 Candidates  = uint16(zeros(65000,length(Cand(1,:))));
0019 
0020 count = 0;
0021 
0022 tic
0023 
0024 if Verbose > 0,
0025   fprintf('Seconds remaining:');
0026 end
0027 
0028 
0029 for i=1:s,
0030   A = xDiscrepancyFast(Model,File(Cand(i,N+1)).NT(Cand(i,[1:N])));
0031 
0032   if A >= 0,
0033     count = count + 1;
0034     Discrepancy(count,1) = A;
0035     Candidates(count,:)  = Cand(i,:);
0036   end
0037 
0038   if (mod(i,round(s/10)) == 0) && (Verbose > 0)
0039     fprintf(' %d', fix((s-i)*toc/i)); 
0040     drawnow
0041   end
0042 end
0043 
0044 if Verbose > 0,
0045   fprintf('\n');
0046 end
0047 
0048 Candidates  = Candidates(1:count,:);
0049 Discrepancy = sqrt(Discrepancy(1:count,1))/Model.NumNT;
0050 
0051 [y,i]       = sort(Discrepancy);                    % sort by discrepancy
0052 Candidates  = Candidates(i,:);
0053 Discrepancy = Discrepancy(i);
0054 
0055 if Verbose > 1,
0056   fprintf('Calculating discrepancy took        %8.3f seconds\n',toc);
0057 end
0058 
0059 drawnow
0060

Generated on Fri 03-Apr-2009 09:52:35 by m2html © 2003