function [xwght] = zgn_iniscalx( x, xthrsh, iniscalx)
%
%  M-function zgn_iniscalx set the inital weighting vector
%  for the iterates x for NLSQ_RES and NLSQ_ERR
%
  if iniscalx == 0
    xwght = max ( abs (x(:)) , xthrsh(:));
  elseif iniscalx == 1
    xwght = xthrsh;
  elseif iniscalx == 2
    n = length(x); 
    xwght = ones(n,1);
  end
