mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 14:13:15 +08:00
Initial commit for Conjugate Gradient method
Implementation is based on http://www.cs.cmu.edu/~quake-papers/painless-conjugate-gradient.pdf So far we only have basic interface and empty test. But it compiles at least.
This commit is contained in:
parent
0ecd7913f8
commit
eb1333d0a8
@ -10,3 +10,4 @@ optim. Generic numerical optimization
|
||||
linear_programming
|
||||
downhill_simplex_method
|
||||
primal_dual_algorithm
|
||||
conjugate_gradient
|
||||
|
@ -54,7 +54,6 @@ public:
|
||||
{
|
||||
public:
|
||||
virtual ~Function() {}
|
||||
//! ndim - dimensionality
|
||||
virtual double calc(const double* x) const = 0;
|
||||
};
|
||||
|
||||
@ -86,6 +85,23 @@ CV_EXPORTS_W Ptr<DownhillSolver> createDownhillSolver(const Ptr<Solver::Function
|
||||
InputArray initStep=Mat_<double>(1,1,0.0),
|
||||
TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5000,0.000001));
|
||||
|
||||
//! conjugate gradient method
|
||||
class CV_EXPORTS ConjGradSolver : public Solver
|
||||
{
|
||||
public:
|
||||
class CV_EXPORTS Function : public Solver::Function
|
||||
{
|
||||
public:
|
||||
//! gradient is like the first derivative for multivar function
|
||||
virtual void getGradient(const double* x,double* buf)const=0;
|
||||
//! Jacobian is like the second derivative
|
||||
virtual void getJacobian(const double* x)const=0;
|
||||
};
|
||||
};
|
||||
|
||||
CV_EXPORTS_W Ptr<ConjGradSolver> createConjGradSolver(const Ptr<Solver::Function>& f=Ptr<ConjGradSolver::Function>(),
|
||||
TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5000,0.000001));
|
||||
|
||||
//!the return codes for solveLP() function
|
||||
enum
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user