Force param.s to lie in ellipsoid defined by variances. More...
#include <msm_ellipsoid_limiter.h>
Public Member Functions | |
msm_ellipsoid_limiter () | |
virtual | ~msm_ellipsoid_limiter () |
virtual void | set_param_var (const vnl_vector< double > &v) |
Define variance on each parameter. | |
virtual void | set_acceptance (double prop, unsigned n_modes=0) |
Set the limits so that a given proportion pass. | |
virtual void | apply_limit (vnl_vector< double > &b) const |
Apply limit to parameter vector b. | |
void | set_n_sds (double n_sds) |
Define number of SDs to limit at. | |
double | mahalanobis (const vnl_vector< double > &b) const |
Return square of Mahalanobis distance to origin. | |
double | slide_closer (vnl_vector< double > &b, const vnl_vector< double > &y) const |
Given initial b on ellipsoid, move on surface towards y. | |
virtual vcl_string | is_a () const |
Name of the class. | |
virtual msm_param_limiter * | clone () const |
Create a copy on the heap and return base class pointer. | |
virtual void | print_summary (vcl_ostream &os) const |
Print class to os. | |
virtual void | b_write (vsl_b_ostream &bfs) const |
Save class to binary file stream. | |
virtual void | b_read (vsl_b_istream &bfs) |
Load class from binary file stream. | |
virtual void | config_from_stream (vcl_istream &is) |
Initialise from a text stream. | |
Static Public Member Functions | |
static vcl_auto_ptr < msm_param_limiter > | create_from_stream (vcl_istream &is) |
Create a concrete msm_param_limiter-derived object, from a text specification. | |
Private Attributes | |
vnl_vector< double > | mode_var_ |
Var. on each mode. | |
double | M_max_ |
Max. allowed mahalanobis distance. | |
double | accept_prop_ |
Proportion of Gaussian to be accepted. |
Force param.s to lie in ellipsoid defined by variances.
An axis aligned ellipsoid is defined by the variances along each dimension and the n_sds parameter. If the supplied vector b is outside this ellipsoid, b is set to the nearest point on the surface of the ellipsoid.
Definition at line 18 of file msm_ellipsoid_limiter.h.
msm_ellipsoid_limiter::msm_ellipsoid_limiter | ( | ) |
Definition at line 16 of file msm_ellipsoid_limiter.cxx.
virtual msm_ellipsoid_limiter::~msm_ellipsoid_limiter | ( | ) | [inline, virtual] |
Definition at line 35 of file msm_ellipsoid_limiter.h.
void msm_ellipsoid_limiter::apply_limit | ( | vnl_vector< double > & | b | ) | const [virtual] |
Apply limit to parameter vector b.
Implements msm_param_limiter.
Definition at line 84 of file msm_ellipsoid_limiter.cxx.
void msm_ellipsoid_limiter::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Implements msm_param_limiter.
Definition at line 127 of file msm_ellipsoid_limiter.cxx.
void msm_ellipsoid_limiter::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Implements msm_param_limiter.
Definition at line 117 of file msm_ellipsoid_limiter.cxx.
msm_param_limiter * msm_ellipsoid_limiter::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Implements msm_param_limiter.
Definition at line 152 of file msm_ellipsoid_limiter.cxx.
void msm_ellipsoid_limiter::config_from_stream | ( | vcl_istream & | is | ) | [virtual] |
Initialise from a text stream.
The default implementation is for attribute-less normalisers, and throws if it finds any data in the stream.
Reimplemented from msm_param_limiter.
Definition at line 160 of file msm_ellipsoid_limiter.cxx.
vcl_auto_ptr< msm_param_limiter > msm_param_limiter::create_from_stream | ( | vcl_istream & | is | ) | [static, inherited] |
Create a concrete msm_param_limiter-derived object, from a text specification.
Definition at line 47 of file msm_param_limiter.cxx.
vcl_string msm_ellipsoid_limiter::is_a | ( | ) | const [virtual] |
Name of the class.
Implements msm_param_limiter.
Definition at line 146 of file msm_ellipsoid_limiter.cxx.
double msm_ellipsoid_limiter::mahalanobis | ( | const vnl_vector< double > & | b | ) | const |
Return square of Mahalanobis distance to origin.
Definition at line 49 of file msm_ellipsoid_limiter.cxx.
void msm_ellipsoid_limiter::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
Print class to os.
Implements msm_param_limiter.
Definition at line 109 of file msm_ellipsoid_limiter.cxx.
void msm_ellipsoid_limiter::set_acceptance | ( | double | prop, |
unsigned | n_modes = 0 |
||
) | [virtual] |
Set the limits so that a given proportion pass.
Where the parameters are described by a pdf, choose limits so that on average a proportion prop (in [0,1]) are acceptable when using n_modes modes. If n_modes==0, then assume all available modes to be used.
Implements msm_param_limiter.
Definition at line 39 of file msm_ellipsoid_limiter.cxx.
void msm_ellipsoid_limiter::set_n_sds | ( | double | n_sds | ) |
Define number of SDs to limit at.
Definition at line 22 of file msm_ellipsoid_limiter.cxx.
void msm_ellipsoid_limiter::set_param_var | ( | const vnl_vector< double > & | v | ) | [virtual] |
Define variance on each parameter.
Implements msm_param_limiter.
Definition at line 28 of file msm_ellipsoid_limiter.cxx.
double msm_ellipsoid_limiter::slide_closer | ( | vnl_vector< double > & | b, |
const vnl_vector< double > & | y | ||
) | const |
Given initial b on ellipsoid, move on surface towards y.
Finds closest point to y in tangent plane at initial b Replaces b with normalised version of this. Returns square of length of movement relative to smallest mode variance.
Finds closest point to y in tangent plane at initial b Replaces b with normalised version of this.
Definition at line 61 of file msm_ellipsoid_limiter.cxx.
double msm_ellipsoid_limiter::accept_prop_ [private] |
Proportion of Gaussian to be accepted.
Used to set M_max when mode_var defined.
Definition at line 29 of file msm_ellipsoid_limiter.h.
double msm_ellipsoid_limiter::M_max_ [private] |
Max. allowed mahalanobis distance.
Definition at line 25 of file msm_ellipsoid_limiter.h.
vnl_vector<double> msm_ellipsoid_limiter::mode_var_ [private] |
Var. on each mode.
Definition at line 22 of file msm_ellipsoid_limiter.h.