1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

extended MinProblemSolver::Function to 1) report the space dimensionality, 2) compute gradient if needed

This commit is contained in:
Vadim Pisarevsky
2015-05-05 15:56:06 +03:00
parent 5b9182ba43
commit 63a63e3eaa
5 changed files with 32 additions and 5 deletions
@@ -68,11 +68,13 @@ static void mytest(cv::Ptr<cv::DownhillSolver> solver,cv::Ptr<cv::MinProblemSolv
class SphereF:public cv::MinProblemSolver::Function{
public:
int getDims() const { return 2; }
double calc(const double* x)const{
return x[0]*x[0]+x[1]*x[1];
}
};
class RosenbrockF:public cv::MinProblemSolver::Function{
int getDims() const { return 2; }
double calc(const double* x)const{
return 100*(x[1]-x[0]*x[0])*(x[1]-x[0]*x[0])+(1-x[0])*(1-x[0]);
}