Base for objects which compute a cost function for one basis direction. More...
#include <mcal_single_basis_cost.h>
Public Member Functions | |
mcal_single_basis_cost () | |
Dflt ctor. | |
virtual | ~mcal_single_basis_cost () |
Destructor. | |
virtual bool | can_use_variance () const =0 |
Returns true if cost can be computed from the variance, rather than requiring all the data. | |
virtual double | cost (const vnl_vector< double > &unit_basis, const vnl_vector< double > &projections)=0 |
Compute component of the cost function from given basis vector. | |
virtual double | cost_from_variance (const vnl_vector< double > &unit_basis, double variance)=0 |
Compute component of the cost function from given basis vector. | |
short | version_no () const |
Version number for I/O. | |
virtual vcl_string | is_a () const =0 |
Name of the class. | |
virtual mcal_single_basis_cost * | clone () const =0 |
Create a copy on the heap and return base class pointer. | |
virtual void | print_summary (vcl_ostream &os) const =0 |
Print class to os. | |
virtual void | b_write (vsl_b_ostream &bfs) const =0 |
Save class to binary file stream. | |
virtual void | b_read (vsl_b_istream &bfs)=0 |
Load class from binary file stream. | |
virtual void | config_from_stream (vcl_istream &) |
Read initialisation settings from a stream. | |
Static Public Member Functions | |
static vcl_auto_ptr < mcal_single_basis_cost > | create_from_stream (vcl_istream &is) |
Create a concrete mcal_single_basis_cost object, from a text specification. |
Base for objects which compute a cost function for one basis direction.
We assume that the component analysis aims to choose a set of orthogonal directions which minimise a cost function which can we expressed as a sum of terms, one per basis vector.
Objects derived from this class are responsible for computing that component of the total cost function.
Some cost functions only require the variance of the projection of the data onto the direction of interest (about the origin). In that case the can_use_variance() should return true, and the cost_from_variance() function implemented.
Definition at line 26 of file mcal_single_basis_cost.h.
mcal_single_basis_cost::mcal_single_basis_cost | ( | ) |
Dflt ctor.
Definition at line 13 of file mcal_single_basis_cost.cxx.
mcal_single_basis_cost::~mcal_single_basis_cost | ( | ) | [virtual] |
Destructor.
Definition at line 19 of file mcal_single_basis_cost.cxx.
virtual void mcal_single_basis_cost::b_read | ( | vsl_b_istream & | bfs | ) | [pure virtual] |
Load class from binary file stream.
Implemented in mcal_sparse_basis_cost, and mcal_var_basis_cost.
virtual void mcal_single_basis_cost::b_write | ( | vsl_b_ostream & | bfs | ) | const [pure virtual] |
Save class to binary file stream.
Implemented in mcal_sparse_basis_cost, and mcal_var_basis_cost.
virtual bool mcal_single_basis_cost::can_use_variance | ( | ) | const [pure virtual] |
Returns true if cost can be computed from the variance, rather than requiring all the data.
Implemented in mcal_sparse_basis_cost, and mcal_var_basis_cost.
virtual mcal_single_basis_cost* mcal_single_basis_cost::clone | ( | ) | const [pure virtual] |
Create a copy on the heap and return base class pointer.
Implemented in mcal_sparse_basis_cost, and mcal_var_basis_cost.
void mcal_single_basis_cost::config_from_stream | ( | vcl_istream & | is | ) | [virtual] |
Read initialisation settings from a stream.
The default implementation merely checks that no properties have been specified.
Reimplemented in mcal_sparse_basis_cost, and mcal_var_basis_cost.
Definition at line 72 of file mcal_single_basis_cost.cxx.
virtual double mcal_single_basis_cost::cost | ( | const vnl_vector< double > & | unit_basis, |
const vnl_vector< double > & | projections | ||
) | [pure virtual] |
Compute component of the cost function from given basis vector.
[in] | unit_basis | Unit vector defining basis direction |
[in] | projections | Projections of the dataset onto this basis vector |
Implemented in mcal_sparse_basis_cost, and mcal_var_basis_cost.
virtual double mcal_single_basis_cost::cost_from_variance | ( | const vnl_vector< double > & | unit_basis, |
double | variance | ||
) | [pure virtual] |
Compute component of the cost function from given basis vector.
Only relevant if can_use_variance() is true. This allows more efficient function evaluation in that case.
[in] | unit_basis | Unit vector defining basis direction |
[in] | variance | Variance of projections of the dataset onto this basis vector |
Implemented in mcal_sparse_basis_cost, and mcal_var_basis_cost.
vcl_auto_ptr< mcal_single_basis_cost > mcal_single_basis_cost::create_from_stream | ( | vcl_istream & | is | ) | [static] |
Create a concrete mcal_single_basis_cost object, from a text specification.
Definition at line 48 of file mcal_single_basis_cost.cxx.
vcl_string mcal_single_basis_cost::is_a | ( | ) | const [pure virtual] |
Name of the class.
Implemented in mcal_sparse_basis_cost, and mcal_var_basis_cost.
Definition at line 40 of file mcal_single_basis_cost.cxx.
virtual void mcal_single_basis_cost::print_summary | ( | vcl_ostream & | os | ) | const [pure virtual] |
Print class to os.
Implemented in mcal_sparse_basis_cost, and mcal_var_basis_cost.
short mcal_single_basis_cost::version_no | ( | ) | const |
Version number for I/O.
Reimplemented in mcal_sparse_basis_cost, and mcal_var_basis_cost.
Definition at line 26 of file mcal_single_basis_cost.cxx.