Public Types | Public Member Functions | Public Attributes | Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | List of all members
Eigen::BDCSVD< _MatrixType > Class Template Reference

class Bidiagonal Divide and Conquer SVD More...

#include <ForwardDeclarations.h>

Inheritance diagram for Eigen::BDCSVD< _MatrixType >:
Inheritance graph
[legend]

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 Types inherited from Eigen::SVDBase< BDCSVD< _MatrixType > >
enum  
 
typedef Eigen::Index Index
 
typedef internal::traits< BDCSVD< _MatrixType > >::MatrixType MatrixType
 
typedef Matrix< Scalar, RowsAtCompileTime, RowsAtCompileTime, MatrixOptions, MaxRowsAtCompileTime, MaxRowsAtCompileTimeMatrixUType
 
typedef Matrix< Scalar, ColsAtCompileTime, ColsAtCompileTime, MatrixOptions, MaxColsAtCompileTime, MaxColsAtCompileTimeMatrixVType
 
typedef NumTraits< typename MatrixType::Scalar >::Real RealScalar
 
typedef MatrixType::Scalar Scalar
 
typedef internal::plain_diag_type< MatrixType, RealScalar >::type SingularValuesType
 
typedef MatrixType::StorageIndex StorageIndex
 

Public Member Functions

 BDCSVD ()
 Default Constructor. More...
 
 BDCSVD (Index rows, Index cols, unsigned int computationOptions=0)
 Default Constructor with memory preallocation. More...
 
 BDCSVD (const MatrixType &matrix, unsigned int computationOptions=0)
 Constructor performing the decomposition of given matrix. More...
 
BDCSVDcompute (const MatrixType &matrix, unsigned int computationOptions)
 Method performing the decomposition of given matrix using custom options. More...
 
BDCSVDcompute (const MatrixType &matrix)
 Method performing the decomposition of given matrix using current options. More...
 
void setSwitchSize (int s)
 
 ~BDCSVD ()
 
- Public Member Functions inherited from Eigen::SVDBase< BDCSVD< _MatrixType > >
EIGEN_DEVICE_FUNC void _solve_impl (const RhsType &rhs, DstType &dst) const
 
Index cols () const
 
bool computeU () const
 
bool computeV () const
 
BDCSVD< _MatrixType > & derived ()
 
const BDCSVD< _MatrixType > & derived () const
 
const MatrixUTypematrixU () const
 
const MatrixVTypematrixV () const
 
Index nonzeroSingularValues () const
 
Index rank () const
 
Index rows () const
 
BDCSVD< _MatrixType > & setThreshold (const RealScalar &threshold)
 
BDCSVD< _MatrixType > & setThreshold (Default_t)
 
const SingularValuesTypesingularValues () const
 
const Solve< BDCSVD< _MatrixType >, Rhs > solve (const MatrixBase< Rhs > &b) const
 
RealScalar threshold () const
 

Public Attributes

int m_numIters
 

Protected Attributes

int m_algoswap
 
bool m_compU
 
MatrixXr m_computed
 
bool m_compV
 
bool m_isTranspose
 
MatrixXr m_naiveU
 
MatrixXr m_naiveV
 
Index m_nRec
 
ArrayXr m_workspace
 
ArrayXi m_workspaceI
 
- Protected Attributes inherited from Eigen::SVDBase< BDCSVD< _MatrixType > >
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
 
RealScalar m_prescribedThreshold
 
Index m_rows
 
SingularValuesType m_singularValues
 
bool m_usePrescribedThreshold
 

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)
 

Additional Inherited Members

- Protected Member Functions inherited from Eigen::SVDBase< BDCSVD< _MatrixType > >
bool allocate (Index rows, Index cols, unsigned int computationOptions)
 
 SVDBase ()
 Default Constructor. More...
 
- Static Protected Member Functions inherited from Eigen::SVDBase< BDCSVD< _MatrixType > >
static void check_template_parameters ()
 

Detailed Description

template<typename _MatrixType>
class Eigen::BDCSVD< _MatrixType >

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 perfroms 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 259 of file ForwardDeclarations.h.

Member Typedef Documentation

template<typename _MatrixType>
typedef Ref<ArrayXr> Eigen::BDCSVD< _MatrixType >::ArrayRef

Definition at line 100 of file BDCSVD.h.

template<typename _MatrixType>
typedef Array<Index,1,Dynamic> Eigen::BDCSVD< _MatrixType >::ArrayXi

Definition at line 99 of file BDCSVD.h.

template<typename _MatrixType>
typedef Array<RealScalar, Dynamic, 1> Eigen::BDCSVD< _MatrixType >::ArrayXr

Definition at line 98 of file BDCSVD.h.

template<typename _MatrixType>
typedef SVDBase<BDCSVD> Eigen::BDCSVD< _MatrixType >::Base
private

Definition at line 69 of file BDCSVD.h.

template<typename _MatrixType>
typedef Ref<ArrayXi> Eigen::BDCSVD< _MatrixType >::IndicesRef

Definition at line 101 of file BDCSVD.h.

template<typename _MatrixType>
typedef NumTraits<RealScalar>::Literal Eigen::BDCSVD< _MatrixType >::Literal

Definition at line 80 of file BDCSVD.h.

template<typename _MatrixType>
typedef _MatrixType Eigen::BDCSVD< _MatrixType >::MatrixType

Definition at line 77 of file BDCSVD.h.

template<typename _MatrixType>
typedef Base::MatrixUType Eigen::BDCSVD< _MatrixType >::MatrixUType

Definition at line 91 of file BDCSVD.h.

template<typename _MatrixType>
typedef Base::MatrixVType Eigen::BDCSVD< _MatrixType >::MatrixVType

Definition at line 92 of file BDCSVD.h.

template<typename _MatrixType>
typedef Matrix<Scalar, Dynamic, Dynamic, ColMajor> Eigen::BDCSVD< _MatrixType >::MatrixX

Definition at line 95 of file BDCSVD.h.

template<typename _MatrixType>
typedef Matrix<RealScalar, Dynamic, Dynamic, ColMajor> Eigen::BDCSVD< _MatrixType >::MatrixXr

Definition at line 96 of file BDCSVD.h.

template<typename _MatrixType>
typedef NumTraits<typename MatrixType::Scalar>::Real Eigen::BDCSVD< _MatrixType >::RealScalar

Definition at line 79 of file BDCSVD.h.

template<typename _MatrixType>
typedef MatrixType::Scalar Eigen::BDCSVD< _MatrixType >::Scalar

Definition at line 78 of file BDCSVD.h.

template<typename _MatrixType>
typedef Base::SingularValuesType Eigen::BDCSVD< _MatrixType >::SingularValuesType

Definition at line 93 of file BDCSVD.h.

template<typename _MatrixType>
typedef Matrix<RealScalar, Dynamic, 1> Eigen::BDCSVD< _MatrixType >::VectorType

Definition at line 97 of file BDCSVD.h.

Member Enumeration Documentation

template<typename _MatrixType>
anonymous enum
Enumerator
RowsAtCompileTime 
ColsAtCompileTime 
DiagSizeAtCompileTime 
MaxRowsAtCompileTime 
MaxColsAtCompileTime 
MaxDiagSizeAtCompileTime 
MatrixOptions 

Definition at line 81 of file BDCSVD.h.

Constructor & Destructor Documentation

template<typename _MatrixType>
Eigen::BDCSVD< _MatrixType >::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 108 of file BDCSVD.h.

template<typename _MatrixType>
Eigen::BDCSVD< _MatrixType >::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 118 of file BDCSVD.h.

template<typename _MatrixType>
Eigen::BDCSVD< _MatrixType >::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 134 of file BDCSVD.h.

template<typename _MatrixType>
Eigen::BDCSVD< _MatrixType >::~BDCSVD ( )
inline

Definition at line 140 of file BDCSVD.h.

Member Function Documentation

template<typename MatrixType >
void Eigen::BDCSVD< MatrixType >::allocate ( Index  rows,
Index  cols,
unsigned int  computationOptions 
)
private

Definition at line 215 of file BDCSVD.h.

template<typename MatrixType >
BDCSVD< MatrixType > & Eigen::BDCSVD< MatrixType >::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 238 of file BDCSVD.h.

template<typename _MatrixType>
BDCSVD& Eigen::BDCSVD< _MatrixType >::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 162 of file BDCSVD.h.

template<typename MatrixType >
void Eigen::BDCSVD< MatrixType >::computeSingVals ( const ArrayRef col0,
const ArrayRef diag,
const IndicesRef perm,
VectorType singVals,
ArrayRef  shifts,
ArrayRef  mus 
)
private

Definition at line 706 of file BDCSVD.h.

template<typename MatrixType >
void Eigen::BDCSVD< MatrixType >::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 930 of file BDCSVD.h.

template<typename MatrixType >
void Eigen::BDCSVD< MatrixType >::computeSVDofM ( Index  firstCol,
Index  n,
MatrixXr U,
VectorType singVals,
MatrixXr V 
)
private

Definition at line 571 of file BDCSVD.h.

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

Definition at line 312 of file BDCSVD.h.

template<typename MatrixType >
void Eigen::BDCSVD< MatrixType >::deflation ( Index  firstCol,
Index  lastCol,
Index  k,
Index  firstRowW,
Index  firstColW,
Index  shift 
)
private

Definition at line 1044 of file BDCSVD.h.

template<typename MatrixType >
void Eigen::BDCSVD< MatrixType >::deflation43 ( Index  firstCol,
Index  shift,
Index  i,
Index  size 
)
private

Definition at line 975 of file BDCSVD.h.

template<typename MatrixType >
void Eigen::BDCSVD< MatrixType >::deflation44 ( Index  firstColu,
Index  firstColm,
Index  firstRowW,
Index  firstColW,
Index  i,
Index  j,
Index  size 
)
private

Definition at line 1004 of file BDCSVD.h.

template<typename MatrixType >
void Eigen::BDCSVD< MatrixType >::divide ( Index  firstCol,
Index  lastCol,
Index  firstRowW,
Index  firstColW,
Index  shift 
)
private

Definition at line 391 of file BDCSVD.h.

template<typename MatrixType >
void Eigen::BDCSVD< MatrixType >::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 881 of file BDCSVD.h.

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

Definition at line 692 of file BDCSVD.h.

template<typename _MatrixType>
void Eigen::BDCSVD< _MatrixType >::setSwitchSize ( int  s)
inline

Definition at line 167 of file BDCSVD.h.

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

Definition at line 340 of file BDCSVD.h.

Member Data Documentation

template<typename _MatrixType>
int Eigen::BDCSVD< _MatrixType >::m_algoswap
protected

Definition at line 194 of file BDCSVD.h.

template<typename _MatrixType>
bool Eigen::BDCSVD< _MatrixType >::m_compU
protected

Definition at line 195 of file BDCSVD.h.

template<typename _MatrixType>
MatrixXr Eigen::BDCSVD< _MatrixType >::m_computed
protected

Definition at line 190 of file BDCSVD.h.

template<typename _MatrixType>
bool Eigen::BDCSVD< _MatrixType >::m_compV
protected

Definition at line 195 of file BDCSVD.h.

template<typename _MatrixType>
bool Eigen::BDCSVD< _MatrixType >::m_isTranspose
protected

Definition at line 195 of file BDCSVD.h.

template<typename _MatrixType>
MatrixXr Eigen::BDCSVD< _MatrixType >::m_naiveU
protected

Definition at line 189 of file BDCSVD.h.

template<typename _MatrixType>
MatrixXr Eigen::BDCSVD< _MatrixType >::m_naiveV
protected

Definition at line 189 of file BDCSVD.h.

template<typename _MatrixType>
Index Eigen::BDCSVD< _MatrixType >::m_nRec
protected

Definition at line 191 of file BDCSVD.h.

template<typename _MatrixType>
int Eigen::BDCSVD< _MatrixType >::m_numIters

Definition at line 209 of file BDCSVD.h.

template<typename _MatrixType>
ArrayXr Eigen::BDCSVD< _MatrixType >::m_workspace
protected

Definition at line 192 of file BDCSVD.h.

template<typename _MatrixType>
ArrayXi Eigen::BDCSVD< _MatrixType >::m_workspaceI
protected

Definition at line 193 of file BDCSVD.h.


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


hebiros
Author(s): Xavier Artache , Matthew Tesch
autogenerated on Thu Sep 3 2020 04:09:53