function retval = rosenvec(x)
% usage:  y = rosenvec(x)
% description: Returns value of Rosenbrock *vector* function
% assuming that x is a vector of length 2.
% Typical starting points for a min: (1.2,1.2),(-1.2,1).

% a little bit of bulletproofing
if (~isvector(x) | (length(x) ~= 2))
  error('rosen: needs a two-dimensional vector argument');
end
if (size(x,2) ~= 1)
  error('rosen: needs a column vector');
end 
% the actual calculation
retval = sqrt(2)*[10*(x(2)-x(1)^2); (1-x(1))];
