function z=bcv2(A,h1,h2)

% BCV2        Biased cross-validation criterion function.
%          
%             BCV2(A,H1,H2)
% 
%             Christian C. Beardah 1993-94 

n=length(A);

A1=A(:,1);

A2=A(:,2);

M1=A1*ones(size(A1'));

T1=(M1-M1')/h1;

M2=A2*ones(size(A2'));

T2=(M2-M2')/h2;

z=1/(4*pi*n*h1*h2);

T=T1.^2+T2.^2;

T=(T.^2-8*T+8).*knorm(T1).*knorm(T2);

T=T-diag(diag(T));

z=z+sum(sum(T))/(4*n*(n-1)*h1*h2);