Logo Search packages:      
Sourcecode: eigen3 version File versions  Download package

Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Friends

JacobiSVD< _MatrixType, QRPreconditioner > Class Template Reference

Two-sided Jacobi SVD decomposition of a rectangular matrix. More...

#include <JacobiSVD.h>

Collaboration diagram for JacobiSVD< _MatrixType, QRPreconditioner >:
Collaboration graph

List of all members.

Public Types

enum  {
  RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, DiagSizeAtCompileTime = EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime,ColsAtCompileTime), MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
  MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, MaxDiagSizeAtCompileTime = EIGEN_SIZE_MIN_PREFER_FIXED(MaxRowsAtCompileTime,MaxColsAtCompileTime), MatrixOptions = MatrixType::Options
< MatrixType >::type 
typedef MatrixType::Index Index
typedef _MatrixType MatrixType
typedef Matrix< Scalar,
MaxRowsAtCompileTime > 
typedef Matrix< Scalar,
MaxColsAtCompileTime > 
typedef NumTraits< typename
MatrixType::Scalar >::Real 
< MatrixType >::type 
typedef MatrixType::Scalar Scalar
< MatrixType, RealScalar >
typedef Matrix< Scalar,
MaxDiagSizeAtCompileTime > 

Public Member Functions

Index cols () const
JacobiSVDcompute (const MatrixType &matrix)
 Method performing the decomposition of given matrix using current options.
JacobiSVDcompute (const MatrixType &matrix, unsigned int computationOptions)
 Method performing the decomposition of given matrix using custom options.
bool computeU () const
bool computeV () const
 JacobiSVD (Index rows, Index cols, unsigned int computationOptions=0)
 Default Constructor with memory preallocation.
 JacobiSVD ()
 Default Constructor.
 JacobiSVD (const MatrixType &matrix, unsigned int computationOptions=0)
 Constructor performing the decomposition of given matrix.
const MatrixUTypematrixU () const
const MatrixVTypematrixV () const
Index nonzeroSingularValues () const
Index rows () const
const SingularValuesTypesingularValues () const
template<typename Rhs >
const internal::solve_retval
< JacobiSVD, Rhs > 
solve (const MatrixBase< Rhs > &b) const

Protected Attributes

Index m_cols
unsigned int m_computationOptions
bool m_computeFullU
bool m_computeFullV
bool m_computeThinU
bool m_computeThinV
Index m_diagSize
bool m_isAllocated
bool m_isInitialized
MatrixUType m_matrixU
MatrixVType m_matrixV
Index m_nonzeroSingularValues
Index m_rows
SingularValuesType m_singularValues
WorkMatrixType m_workMatrix

Private Member Functions

void allocate (Index rows, Index cols, unsigned int computationOptions)


struct internal::qr_preconditioner_impl
struct internal::svd_precondition_2x2_block_to_be_real

Detailed Description

template<typename _MatrixType, int QRPreconditioner>
class JacobiSVD< _MatrixType, QRPreconditioner >

Two-sided Jacobi SVD decomposition of a rectangular matrix.

MatrixTypethe type of the matrix of which we are computing the SVD decomposition
QRPreconditionerthis optional parameter allows to specify the type of QR decomposition that will be used internally for the R-SVD step for non-square matrices. See discussion of possible values below.

SVD decomposition consists in decomposing any n-by-p matrix A as a product

\[ A = U S V^* \]

where U is a n-by-n unitary, V is a p-by-p unitary, and S is a n-by-p real positive matrix which is zero outside of its main diagonal; the diagonal entries of S are known as the singular values of A and the columns of U and V are known as the left and right singular vectors of A respectively.

Singular values are always sorted in decreasing order.

This JacobiSVD decomposition computes only the singular values by default. If you want U or V, you need to ask for them explicitly.

You can ask for only thin U or V to be computed, meaning the following. In case of a rectangular n-by-p matrix, letting m be the smaller value among n and p, there are only m singular vectors; the remaining columns of U and V do not correspond to actual singular vectors. Asking for thin U or V means asking for only their m first columns to be formed. So U is then a n-by-m matrix, and V is then a p-by-m matrix. Notice that thin U and V are all you need for (least squares) solving.

Here's an example demonstrating basic usage:


This JacobiSVD class is a two-sided Jacobi R-SVD decomposition, ensuring optimal reliability and accuracy. The downside is that it's slower than bidiagonalizing SVD algorithms for large square matrices; however its complexity is still $ O(n^2p) $ where n is the smaller dimension and p is the greater dimension, meaning that it is still of the same order of complexity as the faster bidiagonalizing R-SVD algorithms. In particular, like any R-SVD, it takes advantage of non-squareness in that its complexity is only linear in the greater dimension.

If the input matrix has inf or nan coefficients, the result of the computation is undefined, but the computation is guaranteed to terminate in finite (and reasonable) time.

The possible values for QRPreconditioner are:

See also:

Definition at line 343 of file JacobiSVD.h.

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

Generated by  Doxygen 1.6.0   Back to index