CVR-Lib last update 20 Sep 2009

cvr::linearLeastSquares Class Reference
[Linear Algebra]

Class linearLeastSquares. More...

#include <cvrLinearLeastSquares.h>

Inheritance diagram for cvr::linearLeastSquares:

Inheritance graph
[legend]
Collaboration diagram for cvr::linearLeastSquares:

Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 The parameters for the class linearLeastSquares. More...

Public Types

enum  eAlgorithm { QR, CompleteFactorization, SVD, DCSVD }

Public Member Functions

 linearLeastSquares ()
 linearLeastSquares (const parameters &par)
 linearLeastSquares (const linearLeastSquares &other)
virtual ~linearLeastSquares ()
bool apply (const fmatrix &A, const fvector &b, fvector &x) const
bool apply (const dmatrix &A, const dvector &b, dvector &x) const
bool apply (const fmatrix &A, const fmatrix &b, fmatrix &x) const
bool apply (const dmatrix &A, const dmatrix &b, dmatrix &x) const
linearLeastSquarescopy (const linearLeastSquares &other)
linearLeastSquaresoperator= (const linearLeastSquares &other)
virtual const std::string & name () const
virtual linearLeastSquaresclone () const
virtual linearLeastSquaresnewInstance () const
const parametersgetParameters () const


Detailed Description

Class linearLeastSquares.

Solving the linear least squares problem means to find a solution $x$ for

\[ A x = b \]

by minimizing the Euclidean norm squared of the residual $Ax-b$. Here $A$ is a m x n matrix, with m>n, $x$ is an n-dimensional vector, and $b$ is a m-dimensional vector.

This class is usually used to solve an over-determined system of linear equations, where there is more equations than variables. If the LAPACK library is used, this method can also be employed to solve under-determined system, choosing the solution of minimal norm.

If LAPACK is enabled, the functor provides several algorithms for the same task, which vary in speed and robustness against the ill-conditionness of the matrix A. Please refer to the LAPACK documentation for more details:

See also:
linearLeastSquares::parameters.

Member Enumeration Documentation

Enumeration for the algorithms available.

Enumerator:
QR  QR decomposition: slower but more robust.
CompleteFactorization  Complete Orthogonal Factorization.
SVD  Singular Value Decomposition: slowest but works even with ill-conditioned matrices.
DCSVD  Divide-and-conquer singular value decomposition.


Constructor & Destructor Documentation

cvr::linearLeastSquares::linearLeastSquares (  ) 

Default constructor.

cvr::linearLeastSquares::linearLeastSquares ( const parameters par  ) 

Construct a functor using the given parameters.

cvr::linearLeastSquares::linearLeastSquares ( const linearLeastSquares other  ) 

Copy constructor.

Parameters:
other the object to be copied

virtual cvr::linearLeastSquares::~linearLeastSquares (  )  [virtual]

Destructor.


Member Function Documentation

bool cvr::linearLeastSquares::apply ( const dmatrix A,
const dmatrix b,
dmatrix x 
) const

Find the solution $x$ for

\[ A x = b \]

.

Parameters:
A matrix A
b each column is a vector b
x each column is a vector x where the solution is stored for the corresponding column in b.
The dimension of b and the number of rows of A must be identical. The resulting dimension of x will be identical to the number of columns of A.

The internal state of the class will store the decomposition of the matrix A, so that the other apply methods with other b vectors can be used.

Returns:
true if apply successful or false otherwise.

bool cvr::linearLeastSquares::apply ( const fmatrix A,
const fmatrix b,
fmatrix x 
) const

Find the solution $x$ for

\[ A x = b \]

.

Parameters:
A matrix A
b each column is a vector b
x each column is a vector x where the solution is stored for the corresponding column in b.
The dimension of b and the number of rows of A must be identical. The resulting dimension of x will be identical to the number of columns of A.

The internal state of the class will store the decomposition of the matrix A, so that the other apply methods with other b vectors can be used.

Returns:
true if apply successful or false otherwise.

bool cvr::linearLeastSquares::apply ( const dmatrix A,
const dvector b,
dvector x 
) const

Find the solution $x$ for

\[ A x = b \]

.

Parameters:
A matrix A
b vector b
x vector x where the solution is stored.
The dimension of b and the number of rows of A must be identical. The resulting dimension of x will be identical to the number of columns of A.

The internal state of the class will store the decomposition of the matrix A, so that the other apply methods with other b vectors can be used.

Returns:
true if apply successful or false otherwise.

bool cvr::linearLeastSquares::apply ( const fmatrix A,
const fvector b,
fvector x 
) const

Find the solution $x$ for

\[ A x = b \]

.

Parameters:
A matrix A
b vector b
x vector x where the solution is stored.
The dimension of b and the number of rows of A must be identical. The resulting dimension of x will be identical to the number of columns of A.

The internal state of the class will store the decomposition of the matrix A, so that the other apply methods with other b vectors can be used.

Returns:
true if apply successful or false otherwise.

virtual linearLeastSquares* cvr::linearLeastSquares::clone (  )  const [virtual]

Returns a pointer to a clone of this functor.

Implements cvr::functor.

linearLeastSquares& cvr::linearLeastSquares::copy ( const linearLeastSquares other  ) 

Copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

const parameters& cvr::linearLeastSquares::getParameters (  )  const

Returns used parameters.

Reimplemented from cvr::linearAlgebraFunctor.

virtual const std::string& cvr::linearLeastSquares::name (  )  const [virtual]

Returns the complete name of the functor class.

Implements cvr::functor.

virtual linearLeastSquares* cvr::linearLeastSquares::newInstance (  )  const [virtual]

Returns a pointer to a new instance of this functor.

Implements cvr::functor.

linearLeastSquares& cvr::linearLeastSquares::operator= ( const linearLeastSquares other  ) 

Alias for copy member.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object


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

Generated on Sun Sep 20 22:08:59 2009 for CVR-Lib by Doxygen 1.5.8