Mat_<double> coord_sum(1,ndim,0.0),buf(1,ndim,0.0),y(1,ndim,0.0);
nfunk = 0;
for(i=0;i<ndim+1;++i)
{
y(i) = f->calc(p[i]);
}
y has only ndim elements, while the loop goes over ndim+1
Some interface was refined (most notably, the method for returning
Hessian was removed and the method for getting gradient was added as
optional to base Solver::Function class) and basic code for
setters/getters was added. Now is the time for the real work on an
algorithm.
In response to the pull request comments by Vadim Pisarevsky. In
particular, the following was done:
*)cv::reduce use instead of custom code for calculating
per-coordinate sum
*) naming style of private methods is made consisted with overall --
mixed-case style
*) irrelevant create()'s were removed -- I did not know that copyTo()
method itself calls create