function [v,s] = znormalize(w)
% [v,s] = znormalize(w) - normalize the vector w if it is non-zero.
%  On return, v will be the normalized vector and s will be the
%  length of w.
% $Id: znormalize.m,v 1.2 2001/09/04 00:09:42 smann Exp smann $

s = norm(w);
if s > 1e-9
  v = w/s;
else
  v = w;
  s = 0;
end
