An object that represents a function from R^n -> R. More...
#include <vnl_cost_function.h>

Public Member Functions | |
| vnl_cost_function () | |
| Default constructor. More... | |
| vnl_cost_function (int number_of_unknowns) | |
| Construct with a specified number of unknowns. More... | |
| ~vnl_cost_function () override=default | |
| double | f (vnl_vector< double > const &x) override |
| The main function. Given the parameter vector x, compute the value of f(x). More... | |
| virtual void | gradf (vnl_vector< double > const &x, vnl_vector< double > &gradient) |
| Calculate the gradient of f at parameter vector x. More... | |
| virtual void | compute (vnl_vector< double > const &x, double *f, vnl_vector< double > *g) |
| Compute one or both of f and g. More... | |
| int | get_number_of_unknowns () const |
| Return the number of unknowns. More... | |
| void | fdgradf (vnl_vector< double > const &x, vnl_vector< double > &gradient, double stepsize=1e-5) |
| Compute finite-difference gradient. More... | |
| virtual double | reported_error (double f_value) |
| Called when error is printed for user. More... | |
| vnl_vector< double > | gradf (vnl_vector< double > const &x) |
| Conveniences for printing grad, fdgrad. More... | |
| vnl_vector< double > | fdgradf (vnl_vector< double > const &x) |
| virtual double | get_range_min () const |
| Return bounding cube of range (outputs). More... | |
| virtual double | get_range_max () const |
| Return bounding cube of range (outputs). More... | |
| virtual vnl_unary_function< double, vnl_vector< double > > * | Copy () const |
| Copy should allocate a copy of this on the heap and return it. More... | |
Public Attributes | |
| int | dim |
Protected Member Functions | |
| void | set_number_of_unknowns (int number_of_unknowns) |
| Set number of unknowns. More... | |
An object that represents a function from R^n -> R.
It is commonly used to express the interface of a minimizer.
Definition at line 25 of file vnl_cost_function.h.
|
inline |
Default constructor.
Definition at line 30 of file vnl_cost_function.h.
|
inline |
Construct with a specified number of unknowns.
Definition at line 33 of file vnl_cost_function.h.
|
overridedefault |
|
virtual |
Compute one or both of f and g.
Normally implemented in terms of the above two, but may be faster if specialized. f != 0 => compute f
Definition at line 13 of file vnl_cost_function.cxx.
|
inlinevirtualinherited |
Copy should allocate a copy of this on the heap and return it.
If Subclasses do not implement this function, it will return null, but many applications will never call it, so this may not be a problem for you.
Definition at line 44 of file vnl_unary_function.h.
|
overridevirtual |
The main function. Given the parameter vector x, compute the value of f(x).
Default implementation of f is compute...
Implements vnl_unary_function< double, vnl_vector< double > >.
Reimplemented in vnl_least_squares_cost_function.
Definition at line 20 of file vnl_cost_function.cxx.
| void vnl_cost_function::fdgradf | ( | vnl_vector< double > const & | x, |
| vnl_vector< double > & | gradient, | ||
| double | stepsize = 1e-5 |
||
| ) |
Compute finite-difference gradient.
Compute fd gradient.
Definition at line 43 of file vnl_cost_function.cxx.
| vnl_vector< double > vnl_cost_function::fdgradf | ( | vnl_vector< double > const & | x | ) |
Definition at line 70 of file vnl_cost_function.cxx.
|
inline |
Return the number of unknowns.
Definition at line 48 of file vnl_cost_function.h.
|
virtualinherited |
Return bounding cube of range (outputs).
Definition at line 36 of file vnl_unary_function.hxx.
|
virtualinherited |
Return bounding cube of range (outputs).
Definition at line 29 of file vnl_unary_function.hxx.
|
virtual |
Calculate the gradient of f at parameter vector x.
Default implementation of gradf is to call compute.
Reimplemented in vnl_least_squares_cost_function.
Definition at line 33 of file vnl_cost_function.cxx.
| vnl_vector< double > vnl_cost_function::gradf | ( | vnl_vector< double > const & | x | ) |
Conveniences for printing grad, fdgrad.
Definition at line 63 of file vnl_cost_function.cxx.
|
inlinevirtual |
Called when error is printed for user.
Definition at line 54 of file vnl_cost_function.h.
|
inlineprotected |
Set number of unknowns.
Definition at line 63 of file vnl_cost_function.h.
| int vnl_cost_function::dim |
Definition at line 66 of file vnl_cost_function.h.
1.8.15