Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Linear Algebra Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWSVDecomp<T,SVDCalc>

Module:  Linear Algebra   Group:  Decomposition classes


Does not inherit

Local Index

Members

Synopsis

#include <rw/lapack/sv.h>
#include <rw/lapack/svddccalc.h>

RWGenMat<double> A;
.
.
.
RWSVDecomp<double,RWSVDDivConqCalc<double> >sv(A);

Description

A singular value decomposition is a representation of a matrix A of the form:

where U and V are orthogonal, and E is diagonal. The entries along the diagonal of E are the singular values; the columns of U are the left singular vectors, and the columns of V are the right singular vectors.

The class RWSVDecomp<T> is used to construct and work with singular value decompositions. The singular values are always ordered smallest to largest with this class. You may need more control over the computation of the decomposition than is provided by this class. For example, if you don't need all the singular vectors, you can use the SV decomposition server class, RWSVDecompServer<T>, to do the construction.

The template parameter <SVDCalc> determines the algorithm used by the RWSVDecomp<T> class to compute the singular value decomposition and must implement the following method:


NOTE -- For greater flexibility, the user can implement this method, or the Linear Algebra Module provides two classes to perform this function - RWSVDCalc<T> and RWSVDDivConqCalc<T>. Please see their descriptions in this reference guide for more information.

bool computeSVD(const RWGenMat<T>& A,
RWGenMat<T>& U,
RWGenMat<T>& VT,
RWMathVec<norm_type>& sigma,
norm_type tolerance,
int numLeftVecs = -1
int numRightVecs = -1);

where norm_type is a typedef for rw_numeric_traits<T>::norm_type.

Parameters:

A - The input matrix for which the singular value decomposition is being computed.

U - The output matrix of left singular victors (the columns of U are the left singular vectors).

VT - The output matrix of right singular victors (the rows of VT are the right singular victors).

sigma - The output vector of singular values in descending order.

tolerance - The input singular values with magnitude less than tolerance will be set to zero.

numLeftVectors - The input number of left vectors to compute. If the number is less than zero, the default number of vectors will be computed (it is up to the developer to determine what the default is).

numRightVectors - The input number of right vectors to compute. If the number is less than zero, the default number of vectors will be computed (it is up to the developer to determine what the default is).

The return value is True if the decomposition was successfully computed.

Example

Public Constructors

RWSVDecomp();
RWSVDecomp(const RWSVDecomp<T,SVDCalc>& A);
RWSVDecomp(const RWGenMat<float>, float tol=0);
RWSVDecomp(const RWGenMat<double>, double tol=0);
RWSVDecomp(const RWGenMat<DComplex>, double tol=0);

Public Member Functions

unsigned
cols();
void  
RWSVDecomp<float,SVDCalc>::factor(const
RWGenMat<float>&, float tol=0); void RWSVDecomp<double,SVDCalc>::factor(const
RWGenMat<double>&, double tol=0); void RWSVDecomp<DComplex,SVDCalc>::factor(const
RWGenMat<DComplex>&, double tol=0);
unsigned
fail();
unsigned 
good();
RWMathVec<T>
leftVector(int i);
RWGenMat<T>
leftVectors();
unsigned 
numLeftVectors();
unsigned 
numRightVectors();
unsigned
rank();
RWMathVec<T>
rightVector(int i);
RWGenMat<T>
rightVectors();
unsigned
rows();
T
singularValue(int i);
RWMathVec<T>
singularValues();
void
RWSVDecomp<float,SVDCalc>::truncate(float tol=0);
void
RWSVDecomp<double,SVDCalc>::truncate(double tol=0);
void
RWSVDecomp<DComplex,SVDCalc>::truncate(double tol=0);

Public Member Operator

void    operator=(const RWSVDecomp<T,SVDCalc>&);


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.