
function C = tau_count(d,D);

% TAU_COUNT.M computes the k-Function counts for TAU_PERM.M

% Written by: TONY E. SMITH, 4/27/03

% INPUTS:
%     (i)   d   = vector of distances (di : i=1..n)
%     (ii)  D   = vector of reference distances (dj : j=1..k)
%
% OUTPUTS: C = (1:k) vector containing Point Count


% Initial Calculations

n = length(d) ; %number of distances

k = length(D) ; %number of reference distances

%Count of point frequencies

C = zeros(k,1) ;

%Start Count

Dmax = max(D);

%mbrealscalar(Dmax);

for i = 1:n 
   
   index = 1;    
   
   ctr = 1;   
   
   if d(i) <= Dmax
      
      j = 1;
      
      while j <= k            
         
         if d(i) <= D(j) 
            
            C(j:k) = C(j:k) + 1;
            
            j = k + 1;
            
         else
            
            j = j + 1;
            
         end
         
      end %End While      
            
   end %End If          
      
end %End For



































