Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

vnl_least_squares_function Class Reference

#include <vnl_least_squares_function.h>

Inheritance diagram for vnl_least_squares_function:

Inheritance graph
[legend]
List of all members.

Public Types

enum  UseGradient { no_gradient, use_gradient }

Public Methods

 vnl_least_squares_function (int number_of_unknowns, int number_of_residuals, UseGradient=use_gradient)
virtual ~vnl_least_squares_function ()
void throw_failure ()
void clear_failure ()
virtual void f (vnl_vector< double > const &x, vnl_vector< double > &fx)=0
virtual void gradf (vnl_vector< double > const &x, vnl_matrix< double > &jacobian)
virtual void trace (int iteration, vnl_vector< double > const &x, vnl_vector< double > const &fx)
double rms (vnl_vector< double > const &x)
int get_number_of_unknowns () const
int get_number_of_residuals () const
bool has_gradient () const

Public Attributes

bool failure

Protected Methods

void init (int number_of_unknowns, int number_of_residuals)

Protected Attributes

int p_
int n_
bool use_gradient_
vcl_string print_x_fmt_
vcl_string print_f_fmt_

Detailed Description

Abstract base for minimising functions. vnl_least_squares_function is an abstract base for functions to be minimized by an optimizer. To define your own function to be minimized, subclass from vnl_least_squares_function, and implement the pure virtual f (and optionally grad_f).

Whether or not f ought to be const is a problem. Clients might well want to cache some information during the call, and if they're compute objects, will almost certainly be writing to members during the computation. For the moment it's non-const, but we'll see...

Definition at line 34 of file vnl_least_squares_function.h.


Member Enumeration Documentation

enum vnl_least_squares_function::UseGradient
 

Enumeration values:
no_gradient 
use_gradient 

Definition at line 36 of file vnl_least_squares_function.h.


Constructor & Destructor Documentation

vnl_least_squares_function::vnl_least_squares_function int    number_of_unknowns,
int    number_of_residuals,
UseGradient    = use_gradient
 

Construct vnl_least_squares_function, passing number of parameters. (unknowns, domain dimension) and number of residuals (range dimension). The optional argument should be no_gradient if the gradf function has not been implemented.

virtual vnl_least_squares_function::~vnl_least_squares_function   [virtual]
 


Member Function Documentation

void vnl_least_squares_function::clear_failure  
 

virtual void vnl_least_squares_function::f vnl_vector< double > const &    x,
vnl_vector< double > &    fx
[pure virtual]
 

The main function.\ Given the parameter vector x, compute the vector. of residuals fx. Fx has been sized appropriately before the call.

int vnl_least_squares_function::get_number_of_residuals   const [inline]
 

Return the number of residuals.

Definition at line 83 of file vnl_least_squares_function.h.

References print_f_fmt_, print_x_fmt_, and use_gradient_.

int vnl_least_squares_function::get_number_of_unknowns   const [inline]
 

Return the number of unknowns.

Definition at line 79 of file vnl_least_squares_function.h.

References n_, and p_.

virtual void vnl_least_squares_function::gradf vnl_vector< double > const &    x,
vnl_matrix< double > &    jacobian
[virtual]
 

Calculate the Jacobian, given the parameter vector x.

bool vnl_least_squares_function::has_gradient   const [inline]
 

Return true if the derived class has indicated that gradf has been implemented.

Definition at line 87 of file vnl_least_squares_function.h.

void vnl_least_squares_function::init int    number_of_unknowns,
int    number_of_residuals
[protected]
 

double vnl_least_squares_function::rms vnl_vector< double > const &    x
 

Compute the rms error at x by calling f and returning the norm of the residual. vector.

void vnl_least_squares_function::throw_failure  
 

virtual void vnl_least_squares_function::trace int    iteration,
vnl_vector< double > const &    x,
vnl_vector< double > const &    fx
[virtual]
 

Called after each LM iteration to print debugging etc.


Member Data Documentation

bool vnl_least_squares_function::failure
 

Definition at line 40 of file vnl_least_squares_function.h.

int vnl_least_squares_function::n_ [protected]
 

Definition at line 92 of file vnl_least_squares_function.h.

Referenced by get_number_of_unknowns().

int vnl_least_squares_function::p_ [protected]
 

Definition at line 91 of file vnl_least_squares_function.h.

Referenced by get_number_of_unknowns().

vcl_string vnl_least_squares_function::print_f_fmt_ [protected]
 

Definition at line 95 of file vnl_least_squares_function.h.

Referenced by get_number_of_residuals().

vcl_string vnl_least_squares_function::print_x_fmt_ [protected]
 

Definition at line 94 of file vnl_least_squares_function.h.

Referenced by get_number_of_residuals().

bool vnl_least_squares_function::use_gradient_ [protected]
 

Definition at line 93 of file vnl_least_squares_function.h.

Referenced by get_number_of_residuals().


The documentation for this class was generated from the following file:
Generated at Wed Mar 12 01:13:33 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000