Public Types | Public Member Functions | Public Attributes | Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | List of all members

class Bidiagonal Divide and Conquer SVD More...

#include <ForwardDeclarations.h>

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
}
 
typedef Ref< ArrayXrArrayRef
 
typedef Array< Index, 1, DynamicArrayXi
 
typedef Array< RealScalar, Dynamic, 1 > ArrayXr
 
typedef Ref< ArrayXiIndicesRef
 
typedef NumTraits< RealScalar >::Literal Literal
 
typedef _MatrixType MatrixType
 
typedef Base::MatrixUType MatrixUType
 
typedef Base::MatrixVType MatrixVType
 
typedef Matrix< Scalar, Dynamic, Dynamic, ColMajorMatrixX
 
typedef Matrix< RealScalar, Dynamic, Dynamic, ColMajorMatrixXr
 
typedef NumTraits< typename MatrixType::Scalar >::Real RealScalar
 
typedef MatrixType::Scalar Scalar
 
typedef Base::SingularValuesType SingularValuesType
 
typedef Matrix< RealScalar, Dynamic, 1 > VectorType
 

Public Member Functions

 BDCSVD ()
 Default Constructor. More...
 
 BDCSVD (const MatrixType &matrix, unsigned int computationOptions=0)
 Constructor performing the decomposition of given matrix. More...
 
 BDCSVD (Index rows, Index cols, unsigned int computationOptions=0)
 Default Constructor with memory preallocation. More...
 
Index cols () const
 
BDCSVDcompute (const MatrixType &matrix)
 Method performing the decomposition of given matrix using current options. More...
 
BDCSVDcompute (const MatrixType &matrix, unsigned int computationOptions)
 Method performing the decomposition of given matrix using custom options. More...
 
bool computeU () const
 
bool computeV () const
 
Index rows () const
 
void setSwitchSize (int s)
 
 ~BDCSVD ()
 

Public Attributes

int m_numIters
 

Protected Attributes

int m_algoswap
 
bool m_compU
 
MatrixXr m_computed
 
bool m_computeFullU
 
bool m_computeFullV
 
bool m_computeThinU
 
bool m_computeThinV
 
bool m_compV
 
Index m_diagSize
 
ComputationInfo m_info
 
bool m_isInitialized
 
bool m_isTranspose
 
MatrixUType m_matrixU
 
MatrixVType m_matrixV
 
MatrixXr m_naiveU
 
MatrixXr m_naiveV
 
Index m_nonzeroSingularValues
 
Index m_nRec
 
SingularValuesType m_singularValues
 
ArrayXr m_workspace
 
ArrayXi m_workspaceI
 

Private Types

typedef SVDBase< BDCSVDBase
 

Private Member Functions

void allocate (Index rows, Index cols, unsigned int computationOptions)
 
void computeSingVals (const ArrayRef &col0, const ArrayRef &diag, const IndicesRef &perm, VectorType &singVals, ArrayRef shifts, ArrayRef mus)
 
void computeSingVecs (const ArrayRef &zhat, const ArrayRef &diag, const IndicesRef &perm, const VectorType &singVals, const ArrayRef &shifts, const ArrayRef &mus, MatrixXr &U, MatrixXr &V)
 
void computeSVDofM (Index firstCol, Index n, MatrixXr &U, VectorType &singVals, MatrixXr &V)
 
template<typename HouseholderU , typename HouseholderV , typename NaiveU , typename NaiveV >
void copyUV (const HouseholderU &householderU, const HouseholderV &householderV, const NaiveU &naiveU, const NaiveV &naivev)
 
void deflation (Index firstCol, Index lastCol, Index k, Index firstRowW, Index firstColW, Index shift)
 
void deflation43 (Index firstCol, Index shift, Index i, Index size)
 
void deflation44 (Index firstColu, Index firstColm, Index firstRowW, Index firstColW, Index i, Index j, Index size)
 
void divide (Index firstCol, Index lastCol, Index firstRowW, Index firstColW, Index shift)
 
void perturbCol0 (const ArrayRef &col0, const ArrayRef &diag, const IndicesRef &perm, const VectorType &singVals, const ArrayRef &shifts, const ArrayRef &mus, ArrayRef zhat)
 
void structured_update (Block< MatrixXr, Dynamic, Dynamic > A, const MatrixXr &B, Index n1)
 

Static Private Member Functions

static RealScalar secularEq (RealScalar x, const ArrayRef &col0, const ArrayRef &diag, const IndicesRef &perm, const ArrayRef &diagShifted, RealScalar shift)
 

Detailed Description

class Bidiagonal Divide and Conquer SVD

Template Parameters
_MatrixTypethe type of the matrix of which we are computing the SVD decomposition

This class first reduces the input matrix to bi-diagonal form using class UpperBidiagonalization, and then performs a divide-and-conquer diagonalization. Small blocks are diagonalized using class JacobiSVD. You can control the switching size with the setSwitchSize() method, default is 16. For small matrice (<16), it is thus preferable to directly use JacobiSVD. For larger ones, BDCSVD is highly recommended and can several order of magnitude faster.

Warning
this algorithm is unlikely to provide accurate result when compiled with unsafe math optimizations. For instance, this concerns Intel's compiler (ICC), which performs such optimization by default unless you compile with the -fp-model precise option. Likewise, the -ffast-math option of GCC or clang will significantly degrade the accuracy.
See also
class JacobiSVD

Definition at line 279 of file ForwardDeclarations.h.

Member Typedef Documentation

◆ ArrayRef

Definition at line 106 of file BDCSVD.h.

◆ ArrayXi

Definition at line 105 of file BDCSVD.h.

◆ ArrayXr

Definition at line 104 of file BDCSVD.h.

◆ Base

Definition at line 75 of file BDCSVD.h.

◆ IndicesRef

Definition at line 107 of file BDCSVD.h.

◆ Literal

Definition at line 86 of file BDCSVD.h.

◆ MatrixType

typedef _MatrixType Eigen::BDCSVD::MatrixType

Definition at line 83 of file BDCSVD.h.

◆ MatrixUType

Definition at line 97 of file BDCSVD.h.

◆ MatrixVType

Definition at line 98 of file BDCSVD.h.

◆ MatrixX

Definition at line 101 of file BDCSVD.h.

◆ MatrixXr

Definition at line 102 of file BDCSVD.h.

◆ RealScalar

Definition at line 85 of file BDCSVD.h.

◆ Scalar

typedef MatrixType::Scalar Eigen::BDCSVD::Scalar

Definition at line 84 of file BDCSVD.h.

◆ SingularValuesType

Definition at line 99 of file BDCSVD.h.

◆ VectorType

Definition at line 103 of file BDCSVD.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
RowsAtCompileTime 
ColsAtCompileTime 
DiagSizeAtCompileTime 
MaxRowsAtCompileTime 
MaxColsAtCompileTime 
MaxDiagSizeAtCompileTime 
MatrixOptions 

Definition at line 87 of file BDCSVD.h.

Constructor & Destructor Documentation

◆ BDCSVD() [1/3]

Eigen::BDCSVD::BDCSVD ( )
inline

Default Constructor.

The default constructor is useful in cases in which the user intends to perform decompositions via BDCSVD::compute(const MatrixType&).

Definition at line 114 of file BDCSVD.h.

◆ BDCSVD() [2/3]

Eigen::BDCSVD::BDCSVD ( Index  rows,
Index  cols,
unsigned int  computationOptions = 0 
)
inline

Default Constructor with memory preallocation.

Like the default constructor but with preallocation of the internal data according to the specified problem size.

See also
BDCSVD()

Definition at line 124 of file BDCSVD.h.

◆ BDCSVD() [3/3]

Eigen::BDCSVD::BDCSVD ( const MatrixType matrix,
unsigned int  computationOptions = 0 
)
inline

Constructor performing the decomposition of given matrix.

Parameters
matrixthe matrix to decompose
computationOptionsoptional parameter allowing to specify if you want full or thin U or V unitaries to be computed. By default, none is computed. This is a bit - field, the possible bits are ComputeFullU, ComputeThinU, ComputeFullV, ComputeThinV.

Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not available with the (non - default) FullPivHouseholderQR preconditioner.

Definition at line 140 of file BDCSVD.h.

◆ ~BDCSVD()

Eigen::BDCSVD::~BDCSVD ( )
inline

Definition at line 146 of file BDCSVD.h.

Member Function Documentation

◆ allocate()

void Eigen::BDCSVD::allocate ( Eigen::Index  rows,
Eigen::Index  cols,
unsigned int  computationOptions 
)
private

Definition at line 222 of file BDCSVD.h.

◆ cols()

Index Eigen::SVDBase::cols
inline

Definition at line 213 of file SVDBase.h.

◆ compute() [1/2]

BDCSVD& Eigen::BDCSVD::compute ( const MatrixType matrix)
inline

Method performing the decomposition of given matrix using current options.

Parameters
matrixthe matrix to decompose

This method uses the current computationOptions, as already passed to the constructor or to compute(const MatrixType&, unsigned int).

Definition at line 168 of file BDCSVD.h.

◆ compute() [2/2]

BDCSVD< MatrixType > & Eigen::BDCSVD::compute ( const MatrixType matrix,
unsigned int  computationOptions 
)

Method performing the decomposition of given matrix using custom options.

Parameters
matrixthe matrix to decompose
computationOptionsoptional parameter allowing to specify if you want full or thin U or V unitaries to be computed. By default, none is computed. This is a bit - field, the possible bits are ComputeFullU, ComputeThinU, ComputeFullV, ComputeThinV.

Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf). They also are not available with the (non - default) FullPivHouseholderQR preconditioner.

Definition at line 245 of file BDCSVD.h.

◆ computeSingVals()

void Eigen::BDCSVD::computeSingVals ( const ArrayRef col0,
const ArrayRef diag,
const IndicesRef perm,
VectorType singVals,
ArrayRef  shifts,
ArrayRef  mus 
)
private

Definition at line 739 of file BDCSVD.h.

◆ computeSingVecs()

void Eigen::BDCSVD::computeSingVecs ( const ArrayRef zhat,
const ArrayRef diag,
const IndicesRef perm,
const VectorType singVals,
const ArrayRef shifts,
const ArrayRef mus,
MatrixXr U,
MatrixXr V 
)
private

Definition at line 1066 of file BDCSVD.h.

◆ computeSVDofM()

void Eigen::BDCSVD::computeSVDofM ( Eigen::Index  firstCol,
Eigen::Index  n,
MatrixXr U,
VectorType singVals,
MatrixXr V 
)
private

Definition at line 595 of file BDCSVD.h.

◆ computeU()

bool Eigen::SVDBase::computeU
inline
Returns
true if U (full or thin) is asked for in this SVD decomposition

Definition at line 208 of file SVDBase.h.

◆ computeV()

bool Eigen::SVDBase::computeV
inline
Returns
true if V (full or thin) is asked for in this SVD decomposition

Definition at line 210 of file SVDBase.h.

◆ copyUV()

template<typename HouseholderU , typename HouseholderV , typename NaiveU , typename NaiveV >
void Eigen::BDCSVD::copyUV ( const HouseholderU &  householderU,
const HouseholderV &  householderV,
const NaiveU &  naiveU,
const NaiveV &  naivev 
)
private

Definition at line 332 of file BDCSVD.h.

◆ deflation()

void Eigen::BDCSVD::deflation ( Eigen::Index  firstCol,
Eigen::Index  lastCol,
Eigen::Index  k,
Eigen::Index  firstRowW,
Eigen::Index  firstColW,
Eigen::Index  shift 
)
private

Definition at line 1180 of file BDCSVD.h.

◆ deflation43()

void Eigen::BDCSVD::deflation43 ( Eigen::Index  firstCol,
Eigen::Index  shift,
Eigen::Index  i,
Eigen::Index  size 
)
private

Definition at line 1111 of file BDCSVD.h.

◆ deflation44()

void Eigen::BDCSVD::deflation44 ( Eigen::Index  firstColu,
Eigen::Index  firstColm,
Eigen::Index  firstRowW,
Eigen::Index  firstColW,
Eigen::Index  i,
Eigen::Index  j,
Eigen::Index  size 
)
private

Definition at line 1140 of file BDCSVD.h.

◆ divide()

void Eigen::BDCSVD::divide ( Eigen::Index  firstCol,
Eigen::Index  lastCol,
Eigen::Index  firstRowW,
Eigen::Index  firstColW,
Eigen::Index  shift 
)
private

Definition at line 411 of file BDCSVD.h.

◆ perturbCol0()

void Eigen::BDCSVD::perturbCol0 ( const ArrayRef col0,
const ArrayRef diag,
const IndicesRef perm,
const VectorType singVals,
const ArrayRef shifts,
const ArrayRef mus,
ArrayRef  zhat 
)
private

Definition at line 986 of file BDCSVD.h.

◆ rows()

Index Eigen::SVDBase::rows
inline

Definition at line 212 of file SVDBase.h.

◆ secularEq()

BDCSVD< MatrixType >::RealScalar Eigen::BDCSVD::secularEq ( RealScalar  x,
const ArrayRef col0,
const ArrayRef diag,
const IndicesRef perm,
const ArrayRef diagShifted,
RealScalar  shift 
)
staticprivate

Definition at line 723 of file BDCSVD.h.

◆ setSwitchSize()

void Eigen::BDCSVD::setSwitchSize ( int  s)
inline

Definition at line 173 of file BDCSVD.h.

◆ structured_update()

void Eigen::BDCSVD::structured_update ( Block< MatrixXr, Dynamic, Dynamic A,
const MatrixXr B,
Index  n1 
)
private

Definition at line 360 of file BDCSVD.h.

Member Data Documentation

◆ m_algoswap

int Eigen::BDCSVD::m_algoswap
protected

Definition at line 200 of file BDCSVD.h.

◆ m_compU

bool Eigen::BDCSVD::m_compU
protected

Definition at line 201 of file BDCSVD.h.

◆ m_computed

MatrixXr Eigen::BDCSVD::m_computed
protected

Definition at line 196 of file BDCSVD.h.

◆ m_computeFullU

bool Eigen::SVDBase::m_computeFullU
protected

Definition at line 277 of file SVDBase.h.

◆ m_computeFullV

bool Eigen::SVDBase::m_computeFullV
protected

Definition at line 278 of file SVDBase.h.

◆ m_computeThinU

bool Eigen::SVDBase::m_computeThinU
protected

Definition at line 277 of file SVDBase.h.

◆ m_computeThinV

bool Eigen::SVDBase::m_computeThinV
protected

Definition at line 278 of file SVDBase.h.

◆ m_compV

bool Eigen::BDCSVD::m_compV
protected

Definition at line 201 of file BDCSVD.h.

◆ m_diagSize

Index Eigen::SVDBase::m_diagSize
protected

Definition at line 280 of file SVDBase.h.

◆ m_info

ComputationInfo Eigen::SVDBase::m_info
protected

Definition at line 275 of file SVDBase.h.

◆ m_isInitialized

bool Eigen::SVDBase::m_isInitialized
protected

Definition at line 276 of file SVDBase.h.

◆ m_isTranspose

bool Eigen::BDCSVD::m_isTranspose
protected

Definition at line 201 of file BDCSVD.h.

◆ m_matrixU

MatrixUType Eigen::SVDBase::m_matrixU
protected

Definition at line 272 of file SVDBase.h.

◆ m_matrixV

MatrixVType Eigen::SVDBase::m_matrixV
protected

Definition at line 273 of file SVDBase.h.

◆ m_naiveU

MatrixXr Eigen::BDCSVD::m_naiveU
protected

Definition at line 195 of file BDCSVD.h.

◆ m_naiveV

MatrixXr Eigen::BDCSVD::m_naiveV
protected

Definition at line 195 of file BDCSVD.h.

◆ m_nonzeroSingularValues

Index Eigen::SVDBase::m_nonzeroSingularValues
protected

Definition at line 280 of file SVDBase.h.

◆ m_nRec

Index Eigen::BDCSVD::m_nRec
protected

Definition at line 197 of file BDCSVD.h.

◆ m_numIters

int Eigen::BDCSVD::m_numIters

Definition at line 216 of file BDCSVD.h.

◆ m_singularValues

SingularValuesType Eigen::SVDBase::m_singularValues
protected

Definition at line 274 of file SVDBase.h.

◆ m_workspace

ArrayXr Eigen::BDCSVD::m_workspace
protected

Definition at line 198 of file BDCSVD.h.

◆ m_workspaceI

ArrayXi Eigen::BDCSVD::m_workspaceI
protected

Definition at line 199 of file BDCSVD.h.


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


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:44:25