function retval = leastsqvec(x)
% usage:  y = leastsqvec(x)
% description: returns least squares scalar
% function 1/2*||r(x)||^2 based on parameter
% set myP and function parmfitfn.

global myP;
global parmfitfn;

m = size(myP,1); % get row number of myP
retval = zeros(m,1);
for ii = 1:m
  retval(ii) = feval(parmfitfn,x,myP(ii,:));
end;
