corrected the size of Mat 'y'

http://code.opencv.org/issues/3703

'p' represents 'n+1' points (of dim 'n')  and thus has dimensions (ndim+1) x (ndim). In downhill simplex, we evaluate the function 'f' at these (n+1) points. Here we store these values in 'y', so 'y' must be of dimension 1 x (ndim + 1).

mpts = ndim + 1;

Also, to make things look consistent, I have replace some of the (ndim+1) expressions by mpts.