Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
vpdfl_gaussian_builder Class Reference

Class to build vpdfl_gaussian objects. More...

#include <vpdfl_gaussian_builder.h>

Inheritance diagram for vpdfl_gaussian_builder:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 vpdfl_gaussian_builder ()
 Dflt ctor.
virtual ~vpdfl_gaussian_builder ()
 Destructor.
virtual vpdfl_pdf_basenew_model () const
 Create empty model.
virtual void set_min_var (double min_var)
 Define lower threshold on variance for built models.
virtual double min_var () const
 Get lower threshold on variance for built models.
virtual void build (vpdfl_pdf_base &model, const vnl_vector< double > &mean) const
 Build default model with given mean.
virtual void build (vpdfl_pdf_base &model, mbl_data_wrapper< vnl_vector< double > > &data) const
 Build model from data.
virtual void weighted_build (vpdfl_pdf_base &model, mbl_data_wrapper< vnl_vector< double > > &data, const vcl_vector< double > &wts) const
 Build model from weighted data.
void meanCovar (vnl_vector< double > &mean, vnl_matrix< double > &covar, mbl_data_wrapper< vnl_vector< double > > &data) const
 Computes mean and covariance of given data.
void buildFromCovar (vpdfl_gaussian &model, const vnl_vector< double > &mean, const vnl_matrix< double > &covar) const
 Build model from mean and covariance.
short version_no () const
 Version number for I/O.
virtual vcl_string is_a () const
 Name of the class.
virtual bool is_class (vcl_string const &) const
 Does the name of the class match the argument?.
virtual vpdfl_builder_baseclone () 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)
 Read initialisation settings from a stream.

Static Public Member Functions

static vcl_auto_ptr
< vpdfl_builder_base
new_builder_from_stream (vcl_istream &is)
 Create a vpdfl_builder_base object given a config stream.
static vcl_auto_ptr
< vpdfl_builder_base
new_pdf_builder_from_stream (vcl_istream &)
 Create a vpdfl_builder_base object given a config stream (recursive style).

Protected Member Functions

void updateCovar (vnl_matrix< double > &S, const vnl_vector< double > &v, double w) const
 Add w*v*v.transpose() to S (resizing if necessary).

Private Member Functions

vpdfl_gaussiangaussian (vpdfl_pdf_base &model) const

Private Attributes

double min_var_

Detailed Description

Class to build vpdfl_gaussian objects.

Definition at line 26 of file vpdfl_gaussian_builder.h.


Constructor & Destructor Documentation

vpdfl_gaussian_builder::vpdfl_gaussian_builder ( )

Dflt ctor.

Definition at line 38 of file vpdfl_gaussian_builder.cxx.

vpdfl_gaussian_builder::~vpdfl_gaussian_builder ( ) [virtual]

Destructor.

Definition at line 47 of file vpdfl_gaussian_builder.cxx.


Member Function Documentation

void vpdfl_gaussian_builder::b_read ( vsl_b_istream bfs) [virtual]

Load class from binary file stream.

Implements vpdfl_builder_base.

Reimplemented in vpdfl_pc_gaussian_builder.

Definition at line 327 of file vpdfl_gaussian_builder.cxx.

void vpdfl_gaussian_builder::b_write ( vsl_b_ostream bfs) const [virtual]

Save class to binary file stream.

Implements vpdfl_builder_base.

Reimplemented in vpdfl_pc_gaussian_builder.

Definition at line 316 of file vpdfl_gaussian_builder.cxx.

void vpdfl_gaussian_builder::build ( vpdfl_pdf_base model,
const vnl_vector< double > &  mean 
) const [virtual]

Build default model with given mean.

Implements vpdfl_builder_base.

Reimplemented in vpdfl_pc_gaussian_builder.

Definition at line 82 of file vpdfl_gaussian_builder.cxx.

void vpdfl_gaussian_builder::build ( vpdfl_pdf_base model,
mbl_data_wrapper< vnl_vector< double > > &  data 
) const [virtual]

Build model from data.

Implements vpdfl_builder_base.

Reimplemented in vpdfl_pc_gaussian_builder.

Definition at line 157 of file vpdfl_gaussian_builder.cxx.

void vpdfl_gaussian_builder::buildFromCovar ( vpdfl_gaussian model,
const vnl_vector< double > &  mean,
const vnl_matrix< double > &  covar 
) const

Build model from mean and covariance.

Definition at line 132 of file vpdfl_gaussian_builder.cxx.

vpdfl_builder_base * vpdfl_gaussian_builder::clone ( ) const [virtual]

Create a copy on the heap and return base class pointer.

Implements vpdfl_builder_base.

Reimplemented in vpdfl_pc_gaussian_builder.

Definition at line 298 of file vpdfl_gaussian_builder.cxx.

void vpdfl_gaussian_builder::config_from_stream ( vcl_istream &  is) [virtual]

Read initialisation settings from a stream.

Parameters:

   {
     min_var: 1.0e-6
   }
   
Exceptions:
mbl_exception_parse_errorif the parse fails.

Reimplemented from vpdfl_builder_base.

Reimplemented in vpdfl_pc_gaussian_builder.

Definition at line 365 of file vpdfl_gaussian_builder.cxx.

vpdfl_gaussian & vpdfl_gaussian_builder::gaussian ( vpdfl_pdf_base model) const [private]

Reimplemented in vpdfl_pc_gaussian_builder.

Definition at line 53 of file vpdfl_gaussian_builder.cxx.

vcl_string vpdfl_gaussian_builder::is_a ( ) const [virtual]

Name of the class.

Reimplemented from vpdfl_builder_base.

Reimplemented in vpdfl_pc_gaussian_builder.

Definition at line 270 of file vpdfl_gaussian_builder.cxx.

bool vpdfl_gaussian_builder::is_class ( vcl_string const &  s) const [virtual]

Does the name of the class match the argument?.

Reimplemented from vpdfl_builder_base.

Reimplemented in vpdfl_pc_gaussian_builder.

Definition at line 280 of file vpdfl_gaussian_builder.cxx.

void vpdfl_gaussian_builder::meanCovar ( vnl_vector< double > &  mean,
vnl_matrix< double > &  covar,
mbl_data_wrapper< vnl_vector< double > > &  data 
) const

Computes mean and covariance of given data.

Definition at line 173 of file vpdfl_gaussian_builder.cxx.

double vpdfl_gaussian_builder::min_var ( ) const [virtual]

Get lower threshold on variance for built models.

Implements vpdfl_builder_base.

Definition at line 75 of file vpdfl_gaussian_builder.cxx.

vcl_auto_ptr< vpdfl_builder_base > vpdfl_builder_base::new_builder_from_stream ( vcl_istream &  is) [static, inherited]

Create a vpdfl_builder_base object given a config stream.

Exceptions:
mbl_exceptionif parse error.
vcl_runtime_exceptionif parse error.

This will store the constructed builder.

Incoming properties.

Definition at line 55 of file vpdfl_builder_base.cxx.

vpdfl_pdf_base * vpdfl_gaussian_builder::new_model ( ) const [virtual]

Create empty model.

Implements vpdfl_builder_base.

Reimplemented in vpdfl_pc_gaussian_builder.

Definition at line 61 of file vpdfl_gaussian_builder.cxx.

vcl_auto_ptr< vpdfl_builder_base > vpdfl_builder_base::new_pdf_builder_from_stream ( vcl_istream &  is) [static, inherited]

Create a vpdfl_builder_base object given a config stream (recursive style).

Creates object, then uses config_from_stream(is) to set up internals

Exceptions:
vcl_runtime_exceptionif parse error.

Creates object, then uses config_from_stream(is) to set up internals

Definition at line 145 of file vpdfl_builder_base.cxx.

void vpdfl_gaussian_builder::print_summary ( vcl_ostream &  os) const [virtual]

Print class to os.

Implements vpdfl_builder_base.

Reimplemented in vpdfl_pc_gaussian_builder.

Definition at line 307 of file vpdfl_gaussian_builder.cxx.

void vpdfl_gaussian_builder::set_min_var ( double  min_var) [virtual]

Define lower threshold on variance for built models.

Implements vpdfl_builder_base.

Definition at line 68 of file vpdfl_gaussian_builder.cxx.

void vpdfl_gaussian_builder::updateCovar ( vnl_matrix< double > &  S,
const vnl_vector< double > &  v,
double  w 
) const [protected]

Add w*v*v.transpose() to S (resizing if necessary).

By repeatedly calling this function with a new vector v and weight w You can calculate the Sum of Squares matrix.

Definition at line 102 of file vpdfl_gaussian_builder.cxx.

short vpdfl_gaussian_builder::version_no ( ) const

Version number for I/O.

Reimplemented from vpdfl_builder_base.

Reimplemented in vpdfl_pc_gaussian_builder.

Definition at line 289 of file vpdfl_gaussian_builder.cxx.

void vpdfl_gaussian_builder::weighted_build ( vpdfl_pdf_base model,
mbl_data_wrapper< vnl_vector< double > > &  data,
const vcl_vector< double > &  wts 
) const [virtual]

Build model from weighted data.

Implements vpdfl_builder_base.

Reimplemented in vpdfl_pc_gaussian_builder.

Definition at line 203 of file vpdfl_gaussian_builder.cxx.


Member Data Documentation

Definition at line 28 of file vpdfl_gaussian_builder.h.


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