function retval = rosen(x)
% usage:  y = rosen(x)
% description: Returns value of Rosenbrock function
% assuming that x is a vector of length 2. Use of 
% rosenvec underscores fact that Rosenbrock function
% derives from a least squares problem.
% Typical starting points for a min: (1.2,1.2),(-1.2,1)
% 

vec = feval('rosenvec',x);
retval = 0.5*vec'*vec;