NDDEM
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 <BDCSVD.h>

+ Inheritance diagram for Eigen::BDCSVD< _MatrixType >:

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 _MatrixType MatrixType
 
typedef MatrixType::Scalar Scalar
 
typedef NumTraits< typename MatrixType::Scalar >::Real RealScalar
 
typedef NumTraits< RealScalar >::Literal Literal
 
typedef Base::MatrixUType MatrixUType
 
typedef Base::MatrixVType MatrixVType
 
typedef Base::SingularValuesType SingularValuesType
 
typedef Matrix< Scalar, Dynamic, Dynamic, ColMajorMatrixX
 
typedef Matrix< RealScalar, Dynamic, Dynamic, ColMajorMatrixXr
 
typedef Matrix< RealScalar, Dynamic, 1 > VectorType
 
typedef Array< RealScalar, Dynamic, 1 > ArrayXr
 
typedef Array< Index, 1, DynamicArrayXi
 
typedef Ref< ArrayXrArrayRef
 
typedef Ref< ArrayXiIndicesRef
 
- Public Types inherited from Eigen::SVDBase< BDCSVD< _MatrixType > >
enum  
 
typedef internal::traits< BDCSVD< _MatrixType > >::MatrixType MatrixType
 
typedef MatrixType::Scalar Scalar
 
typedef NumTraits< typename MatrixType::Scalar >::Real RealScalar
 
typedef Eigen::internal::traits< SVDBase >::StorageIndex StorageIndex
 
typedef Eigen::Index Index
 
typedef Matrix< Scalar, RowsAtCompileTime, RowsAtCompileTime, MatrixOptions, MaxRowsAtCompileTime, MaxRowsAtCompileTimeMatrixUType
 
typedef Matrix< Scalar, ColsAtCompileTime, ColsAtCompileTime, MatrixOptions, MaxColsAtCompileTime, MaxColsAtCompileTimeMatrixVType
 
typedef internal::plain_diag_type< MatrixType, RealScalar >::type SingularValuesType
 
- Public Types inherited from Eigen::SolverBase< Derived >
enum  {
  RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime , ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime , SizeAtCompileTime , MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime ,
  MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime , MaxSizeAtCompileTime , IsVectorAtCompileTime , NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0 : bool(IsVectorAtCompileTime) ? 1 : 2
}
 
typedef EigenBase< Derived > Base
 
typedef internal::traits< Derived >::Scalar Scalar
 
typedef Scalar CoeffReturnType
 
typedef internal::add_const< Transpose< const Derived > >::type ConstTransposeReturnType
 
typedef internal::conditional< NumTraits< Scalar >::IsComplex, CwiseUnaryOp< internal::scalar_conjugate_op< Scalar >, ConstTransposeReturnType >, ConstTransposeReturnType >::type AdjointReturnType
 
- Public Types inherited from Eigen::EigenBase< Derived >
typedef Eigen::Index Index
 The interface type of indices. More...
 
typedef internal::traits< Derived >::StorageKind StorageKind
 

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...
 
 ~BDCSVD ()
 
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)
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
- Public Member Functions inherited from Eigen::SVDBase< BDCSVD< _MatrixType > >
BDCSVD< _MatrixType > & derived ()
 
const BDCSVD< _MatrixType > & derived () const
 
const MatrixUTypematrixU () const
 
const MatrixVTypematrixV () const
 
const SingularValuesTypesingularValues () const
 
Index nonzeroSingularValues () const
 
Index rank () const
 
BDCSVD< _MatrixType > & setThreshold (const RealScalar &threshold)
 
BDCSVD< _MatrixType > & setThreshold (Default_t)
 
RealScalar threshold () const
 
bool computeU () const
 
bool computeV () const
 
Index rows () const
 
Index cols () const
 
EIGEN_DEVICE_FUNC ComputationInfo info () const
 Reports whether previous computation was successful. More...
 
void _solve_impl (const RhsType &rhs, DstType &dst) const
 
void _solve_impl_transposed (const RhsType &rhs, DstType &dst) const
 
- Public Member Functions inherited from Eigen::SolverBase< Derived >
 SolverBase ()
 
 ~SolverBase ()
 
template<typename Rhs >
const Solve< Derived, Rhs > solve (const MatrixBase< Rhs > &b) const
 
ConstTransposeReturnType transpose () const
 
AdjointReturnType adjoint () const
 
EIGEN_DEVICE_FUNC Derived & derived ()
 
EIGEN_DEVICE_FUNC const Derived & derived () const
 
- Public Member Functions inherited from Eigen::EigenBase< Derived >
EIGEN_DEVICE_FUNC Derived & derived ()
 
EIGEN_DEVICE_FUNC const Derived & derived () const
 
EIGEN_DEVICE_FUNC Derived & const_cast_derived () const
 
EIGEN_DEVICE_FUNC const Derived & const_derived () const
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size () const EIGEN_NOEXCEPT
 
template<typename Dest >
EIGEN_DEVICE_FUNC void evalTo (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void addTo (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void subTo (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void applyThisOnTheRight (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void applyThisOnTheLeft (Dest &dst) const
 

Public Attributes

int m_numIters
 

Protected Attributes

MatrixXr m_naiveU
 
MatrixXr m_naiveV
 
MatrixXr m_computed
 
Index m_nRec
 
ArrayXr m_workspace
 
ArrayXi m_workspaceI
 
int m_algoswap
 
bool m_isTranspose
 
bool m_compU
 
bool m_compV
 
- Protected Attributes inherited from Eigen::SVDBase< BDCSVD< _MatrixType > >
MatrixUType m_matrixU
 
MatrixVType m_matrixV
 
SingularValuesType m_singularValues
 
ComputationInfo m_info
 
bool m_isInitialized
 
bool m_isAllocated
 
bool m_usePrescribedThreshold
 
bool m_computeFullU
 
bool m_computeThinU
 
bool m_computeFullV
 
bool m_computeThinV
 
unsigned int m_computationOptions
 
Index m_nonzeroSingularValues
 
Index m_rows
 
Index m_cols
 
Index m_diagSize
 
RealScalar m_prescribedThreshold
 

Private Types

typedef SVDBase< BDCSVDBase
 

Private Member Functions

void allocate (Index rows, Index cols, unsigned int computationOptions)
 
void divide (Index firstCol, Index lastCol, Index firstRowW, Index firstColW, Index shift)
 
void computeSVDofM (Index firstCol, Index n, MatrixXr &U, VectorType &singVals, MatrixXr &V)
 
void computeSingVals (const ArrayRef &col0, const ArrayRef &diag, const IndicesRef &perm, VectorType &singVals, ArrayRef shifts, ArrayRef mus)
 
void perturbCol0 (const ArrayRef &col0, const ArrayRef &diag, const IndicesRef &perm, const VectorType &singVals, const ArrayRef &shifts, const ArrayRef &mus, ArrayRef zhat)
 
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 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 deflation (Index firstCol, Index lastCol, Index k, Index firstRowW, Index firstColW, Index shift)
 
template<typename HouseholderU , typename HouseholderV , typename NaiveU , typename NaiveV >
void copyUV (const HouseholderU &householderU, const HouseholderV &householderV, const NaiveU &naiveU, const NaiveV &naivev)
 
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 > >
void _check_compute_assertions () const
 
void _check_solve_assertion (const Rhs &b) const
 
bool allocate (Index rows, Index cols, unsigned int computationOptions)
 
 SVDBase ()
 Default Constructor. More...
 
- Protected Member Functions inherited from Eigen::SolverBase< Derived >
template<bool Transpose_, typename Rhs >
void _check_solve_assertion (const Rhs &b) const
 
- 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 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

Member Typedef Documentation

◆ ArrayRef

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

◆ ArrayXi

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

◆ ArrayXr

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

◆ Base

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

◆ IndicesRef

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

◆ Literal

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

◆ MatrixType

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

◆ MatrixUType

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

◆ MatrixVType

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

◆ MatrixX

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

◆ MatrixXr

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

◆ RealScalar

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

◆ Scalar

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

◆ SingularValuesType

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

◆ VectorType

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

Member Enumeration Documentation

◆ anonymous enum

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

Constructor & Destructor Documentation

◆ BDCSVD() [1/3]

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&).

◆ BDCSVD() [2/3]

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()

◆ BDCSVD() [3/3]

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.

◆ ~BDCSVD()

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

Member Function Documentation

◆ allocate()

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

◆ cols()

template<typename _MatrixType >
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index Eigen::EigenBase< Derived >::cols ( void  )
inline
Returns
the number of columns.
See also
rows(), ColsAtCompileTime

◆ compute() [1/2]

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).

◆ compute() [2/2]

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.

◆ computeSingVals()

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

◆ computeSingVecs()

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

◆ computeSVDofM()

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

◆ copyUV()

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

◆ deflation()

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

◆ deflation43()

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

◆ deflation44()

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

◆ divide()

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

◆ perturbCol0()

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

◆ rows()

template<typename _MatrixType >
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index Eigen::EigenBase< Derived >::rows ( void  )
inline
Returns
the number of rows.
See also
cols(), RowsAtCompileTime

◆ secularEq()

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

◆ setSwitchSize()

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

◆ structured_update()

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

Member Data Documentation

◆ m_algoswap

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

◆ m_compU

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

◆ m_computed

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

◆ m_compV

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

◆ m_isTranspose

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

◆ m_naiveU

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

◆ m_naiveV

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

◆ m_nRec

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

◆ m_numIters

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

◆ m_workspace

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

◆ m_workspaceI

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

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