Into

Modules

Documentation

classPiiOptimization::ResidualFunction

#include <PiiOptimization.h>

An interface for functions optimized with respect to residual values.

Description

This type of function can be optimized with the Levenberg-Marquardt technique.

Constructors and destructor

virtual

Public member functions

virtual int
( )  = 0

Returns the number of functions to minimize.

virtual bool

Returns true if the function is capable of calculating the Jacobian, otherwise returns false.

virtual void
( )

Calculates the Jacobian matrix of the optimized functions at the given position.

virtual void
(
  • const T * params
  • T * residuals
)  = 0

Calculates residuals and stores them into residuals.

Function details

  • virtual ~ResidualFunction

    ()
    [inline, virtual]
  • virtual int functionCount

    ()
    [pure virtual]

    Returns the number of functions to minimize.

    Typically, this value is equal to the number of measurements against which a model is to be fitted.

    Returns

    number of optimized functions (M).

  • virtual bool hasJacobian

    ()
    [inline, virtual]

    Returns true if the function is capable of calculating the Jacobian, otherwise returns false.

    The default implementation returns false.

  • virtual void jacobian

    ( )
    [virtual]

    Calculates the Jacobian matrix of the optimized functions at the given position.

    This function does not always need to be implemented as some optimizers are able to estimate the Jacobian themselves. If the number of parameters is N and the number of optimized functions M, the size of the Jacobian matrix is N-by-M. If we denote the optimized functions by , where x is a N-dimensional parameter vector, then the Jacobian is defined as:

    The function must return a negated version of the Jacobian for optimization purposes.

    The default implementation does nothing.
    Parameters
    params

    an N-element parameter vector

    jacobian

    a N-by-M Jacobian matrix. Must be filled by the implementation.

  • virtual void residualValues

    (
    • const T * params
    • T * residuals
    )
    [pure virtual]

    Calculates residuals and stores them into residuals.

    Let us denote the function to be optimized by f(x). We want to find the parameters x such that f(x) = b. Suppose we are given an approximation of x, denoted by . Since we don't know x, there is not way to calculate the real error , but we can calculate , which is called the residual. This function calculates the residual value for all the functions to be optimized.

    Parameters
    params

    an N-element vector ( )

    residuals

    an M-element vector of residual values calculated by the derived class as described above. M equals to the number of functions to be minimized. This vector is filled by the function.

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.