mexopencv  3.4.1
MEX interface for OpenCV library
Public Member Functions | Static Public Member Functions | List of all members
anonymous_namespace{DownhillSolver_.cpp}::MatlabFunction Class Reference

Represents objective function being optimized, implemented as a MATLAB file. More...

Inheritance diagram for anonymous_namespace{DownhillSolver_.cpp}::MatlabFunction:
cv::MinProblemSolver::Function

Public Member Functions

 MatlabFunction (int num_dims, const string &func)
 Constructor. More...
 
double calc (const double *x) const
 Evaluates MATLAB objective function. More...
 
int getDims () const
 Return number of dimensions. More...
 
MxArray toStruct () const
 Convert object to MxArray. More...
 
- Public Member Functions inherited from cv::MinProblemSolver::Function
virtual ~Function ()
 
virtual void getGradient (const double *x, double *grad)
 
virtual double getGradientEps () const
 

Static Public Member Functions

static Ptr< MatlabFunctioncreate (const MxArray &s)
 Factory function. More...
 

Detailed Description

Represents objective function being optimized, implemented as a MATLAB file.

Definition at line 20 of file DownhillSolver_.cpp.

Constructor & Destructor Documentation

◆ MatlabFunction()

anonymous_namespace{DownhillSolver_.cpp}::MatlabFunction::MatlabFunction ( int  num_dims,
const string func 
)
inline

Constructor.

Parameters
num_dimsnumber of variables of the objective function
funcname of an M-file that computes the objective function

Definition at line 27 of file DownhillSolver_.cpp.

Member Function Documentation

◆ calc()

double anonymous_namespace{DownhillSolver_.cpp}::MatlabFunction::calc ( const double *  x) const
inlinevirtual

Evaluates MATLAB objective function.

Parameters
[in]xinput array of length dims
Returns
objective function evaluated at x (scalar value)

Calculates y = F(x), for the scalar-valued multivariate objective function evaluated at the dims -dimensional point x

Example:

% the following MATLAB function implements the Rosenbrock function.
function f = rosenbrock(x)
dims = numel(x); % dims == 2
f = (x(1) - 1)^2 + 100*(x(2) - x(1)^2)^2;

Implements cv::MinProblemSolver::Function.

Definition at line 47 of file DownhillSolver_.cpp.

◆ create()

static Ptr<MatlabFunction> anonymous_namespace{DownhillSolver_.cpp}::MatlabFunction::create ( const MxArray s)
inlinestatic

Factory function.

Parameters
sinput MxArray structure with the following fields:
  • dims
  • fun
Returns
smart pointer to newly created instance

Definition at line 101 of file DownhillSolver_.cpp.

◆ getDims()

int anonymous_namespace{DownhillSolver_.cpp}::MatlabFunction::getDims ( ) const
inlinevirtual

Return number of dimensions.

Returns
dimensionality of the objective function domain

Implements cv::MinProblemSolver::Function.

Definition at line 79 of file DownhillSolver_.cpp.

◆ toStruct()

MxArray anonymous_namespace{DownhillSolver_.cpp}::MatlabFunction::toStruct ( ) const
inline

Convert object to MxArray.

Returns
output MxArray structure

Definition at line 87 of file DownhillSolver_.cpp.


The documentation for this class was generated from the following file: