function z = discreptik(lam,S,Ghat,Va,Vb,A,B,G,target)

% Function called by fzero to determine Tikhonov regularization parameter
% Compare the norm-squared of the error using parameter lam
% to the target norm-squared error.
% DPO 04/2012

% Compute the approximate solution using parameter lam.

  Fhat = (S.*Ghat) ./ (S.*S+lam^2);
  F = Vb*Fhat*Va';

% Compute the residual (difference between predicted blurred
% image and observed blurred image).  Compare to target.

  z = norm(B*F*A'-G,'fro')^2-target;


