Main Page   Class Hierarchy   Compound List   File List   Compound Members  

PLib::SVDMatrix Class Template Reference

A matrix for the SVD decomposition. More...

#include <matrix/matrixMat.h>

List of all members.

Public Methods

 SVDMatrix ()
 SVDMatrix (const Matrix< T > &A)
int decompose (const Matrix< T > &A)
void minMax (T &min_sig, T &max_sig) const
double q_cond_number (void) const
void cut_off (const double min_sig)
void inverseIn (Matrix< T > &inv, double tau=0)
Matrix< T > inverse (double tau=0)
int solve (const Matrix< T > &B, Matrix< T > &X, double tau=0)

Public Attributes

const Matrix< T > & U
const Matrix< T > & V
const Vector< T > & sig

Protected Methods

double left_householder (Matrix< T > &A, const int i)
double right_householder (Matrix< T > &A, const int i)
double bidiagonalize (Vector< T > &super_diag, const Matrix< T > &_A)
void rotate (Matrix< T > &U, const int i, const int j, const double cos_ph, const double sin_ph)
void rip_through (Vector< T > &super_diag, const int k, const int l, const double eps)
int get_submatrix_to_work_on (Vector< T > &super_diag, const int k, const double eps)
void diagonalize (Vector< T > &super_diag, const double eps)

Protected Attributes

int M
int N
Matrix< T > U_
Matrix< T > V_
Vector< T > sig_


Detailed Description

template<class T>
class PLib::SVDMatrix< T >

A matrix for the SVD decomposition.

This matrix was adapted from the Numerical Math Class Library developed by Oleg Kiselyov.

This class can only be used with floating point values (float or double).

The following comments are from Oleg Kiselyov.

Singular Value Decomposition of a rectangular matrix A=U Sig V' where matrices U and V are orthogonal and Sig is a diagonal matrix.

The singular value decomposition is performed by constructing an SVD object from an M*N matrix A with M \ge N (that is, at least as many rows as columns). Note, in case M > N, matrix Sig has to be a M*N diagonal matrix. However, it has only N diagonal elements, which we store in a vector sig.

Algorithm: Bidiagonalization with Householder reflections followed by a modification of a QR-algorithm. For more details, see G.E. Forsythe, M.A. Malcolm, C.B. Moler Computer methods for mathematical computations, Prentice-Hall, 1977. However, in the present implementation, matrices U and V are computed right away rather than delayed until after all Householder reflections.

This code is based for the most part on a Algol68 code I (Oleg Kiselyov) wrote ca. 1987.

Look at the source code for more information about the algorithm.

Author:
Oleg Kiselyov , Philippe Lavoie
Date:
22 Oct. 1997

Definition at line 179 of file matrixMat.h.


Constructor & Destructor Documentation

template<class T>
PLib::SVDMatrix< T >::SVDMatrix const Matrix< T > &    A
 

Performs the SVD decomposition of A.

Performs the SVD decomposition of A. It is not recommended to use this routine has errors from the decomposition routine are discarded

Parameters:
A  the matrix to decompose
Warning:
The matrix A must have a number equal or higher of rows than columns.
Author:
Philippe Lavoie
Date:
22 October 1997

Definition at line 796 of file matrixMat.cpp.

References decompose.


Member Function Documentation

template<class T>
int PLib::SVDMatrix< T >::decompose const Matrix< T > &    A
 

Performs the SVD decomposition of A.

Performs the SVD decomposition of A.

Parameters:
A  the matrix to decompose
Returns:
1 if the decomposition was succesfull, 0 otherwise.
Warning:
The matrix A must have a number equal or higher of rows than columns.
Author:
Philippe Lavoie
Date:
22 October 1997

Definition at line 817 of file matrixMat.cpp.

References N, sig_, U_, and V_.

Referenced by SVDMatrix.

template<class T>
Matrix< T > PLib::SVDMatrix< T >::inverse double    tau = 0
 

Finds the (pseudo-)inverse of a SVD matrix.

Finds the (pseudo-)inverse of a SVD matrix.

Parameters:
tau  the minimal singular value accepted
Warning:
The SVD matrix must be valid.
Author:
Philippe Lavoie
Date:
22 October 1997

Definition at line 951 of file matrixMat.cpp.

References inverseIn.

template<class T>
void PLib::SVDMatrix< T >::inverseIn Matrix< T > &    A,
double    tau = 0
 

Finds the (pseudo-)inverse of a SVD matrix.

Finds the (pseudo-)inverse of a SVD matrix.

Parameters:
A  the inverse of the SVD matrix
tau  the minimal singular value accepted
Warning:
The SVD matrix must be valid.
Author:
Philippe Lavoie
Date:
22 October 1997

Definition at line 907 of file matrixMat.cpp.

References minMax.

Referenced by inverse.

template<class T>
void PLib::SVDMatrix< T >::minMax T &    min_sig,
T &    max_sig
const
 

Finds the minimal and maximal sigma values.

Finds the minimal and maximal sigma values.

Parameters:
min_sig  the minimal sigma value
max_sig  the maximal sigma value
Warning:
The SVD matrix must be valid.
Author:
Philippe Lavoie
Date:
22 October 1997

Definition at line 862 of file matrixMat.cpp.

Referenced by inverseIn, q_cond_number, and solve.

template<class T>
double PLib::SVDMatrix< T >::q_cond_number void    const
 

Finds the condition number.

Finds the condition number which corresponds to the maximal sigma value divided by its minimal value.

Returns:
The condition number
Warning:
The SVD matrix must be valid.
Author:
Philippe Lavoie
Date:
22 October 1997

Definition at line 886 of file matrixMat.cpp.

References minMax.

template<class T>
int PLib::SVDMatrix< T >::solve const Matrix< T > &    B,
Matrix< T > &    X,
double    tau = 0
 

Solves the linear system A X = B.

Solves the linear system A X = B. Given A and B it finds the value of X. A is the SVD matrix properly initialized and the only other input parameter is B.

Parameters:
B  the right hand side of the equation
X  the resulting matrix
tau  the minimal singular value accepted
Returns:
1 if the routine was able to solve the problem, 0 otherwise.
Warning:
The SVD matrix must be valid and correspond to A.
Author:
Philippe Lavoie
Date:
22 October 1997

Definition at line 977 of file matrixMat.cpp.

References minMax.


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 13:27:01 2003 for NURBS++ by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002