![]() |
|
class Bidiagonal Divide and Conquer SVD More...
#include <BDCSVD.h>
Public Member Functions | |
BDCSVD () | |
Default Constructor. More... | |
BDCSVD (Index rows, Index cols) | |
Default Constructor with memory preallocation. More... | |
EIGEN_DEPRECATED | BDCSVD (Index rows, Index cols, unsigned int computationOptions) |
Default Constructor with memory preallocation. More... | |
BDCSVD (const MatrixType &matrix) | |
Constructor performing the decomposition of given matrix, using the custom options specified with the Options template parameter. More... | |
EIGEN_DEPRECATED | BDCSVD (const MatrixType &matrix, unsigned int computationOptions) |
Constructor performing the decomposition of given matrix using specified options for computing unitaries. More... | |
~BDCSVD () | |
BDCSVD & | compute (const MatrixType &matrix) |
Method performing the decomposition of given matrix. Computes Thin/Full unitaries U/V if specified using the Options template parameter or the class constructor. More... | |
EIGEN_DEPRECATED BDCSVD & | compute (const MatrixType &matrix, unsigned int computationOptions) |
Method performing the decomposition of given matrix, as specified by the computationOptions parameter. More... | |
void | setSwitchSize (int s) |
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index | cols () const EIGEN_NOEXCEPT |
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index | rows () const EIGEN_NOEXCEPT |
![]() | |
BDCSVD< MatrixType_, Options_ > & | derived () |
const BDCSVD< MatrixType_, Options_ > & | derived () const |
const MatrixUType & | matrixU () const |
const MatrixVType & | matrixV () const |
const SingularValuesType & | singularValues () const |
Index | nonzeroSingularValues () const |
Index | rank () const |
BDCSVD< MatrixType_, Options_ > & | setThreshold (const RealScalar &threshold) |
BDCSVD< MatrixType_, Options_ > & | setThreshold (Default_t) |
RealScalar | threshold () const |
bool | computeU () const |
bool | computeV () const |
Index | rows () const |
Index | cols () const |
Index | diagSize () 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 |
![]() | |
SolverBase () | |
~SolverBase () | |
template<typename Rhs > | |
const Solve< Derived, Rhs > | solve (const MatrixBase< Rhs > &b) const |
const ConstTransposeReturnType | transpose () const |
const AdjointReturnType | adjoint () const |
constexpr EIGEN_DEVICE_FUNC Derived & | derived () |
constexpr EIGEN_DEVICE_FUNC const Derived & | derived () const |
![]() | |
constexpr EIGEN_DEVICE_FUNC Derived & | derived () |
constexpr 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 |
template<typename Device > | |
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DeviceWrapper< Derived, Device > | device (Device &device) |
template<typename Device > | |
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DeviceWrapper< const Derived, Device > | device (Device &device) const |
Public Attributes | |
int | m_numIters |
Protected Member Functions | |
void | allocate (Index rows, Index cols, unsigned int computationOptions) |
![]() | |
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... | |
![]() | |
template<bool Transpose_, typename Rhs > | |
void | _check_solve_assertion (const Rhs &b) const |
Private Types | |
typedef SVDBase< BDCSVD > | Base |
Private Member Functions | |
BDCSVD & | compute_impl (const MatrixType &matrix, 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) |
template<typename SVDType > | |
void | computeBaseCase (SVDType &svd, Index n, Index firstCol, Index firstRowW, Index firstColW, Index shift) |
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 | |
![]() | |
static constexpr bool | ShouldComputeFullU |
static constexpr bool | ShouldComputeThinU |
static constexpr bool | ShouldComputeFullV |
static constexpr bool | ShouldComputeThinV |
class Bidiagonal Divide and Conquer SVD
MatrixType_ | the type of the matrix of which we are computing the SVD decomposition |
Options_ | this optional parameter allows one to specify options for computing unitaries U and V. Possible values are ComputeThinU, ComputeThinV, ComputeFullU, ComputeFullV, and DisableQRDecomposition. It is not possible to request both the thin and full version of U or V. By default, unitaries are not computed. BDCSVD uses R-Bidiagonalization to improve performance on tall and wide matrices. For backwards compatility, the option DisableQRDecomposition can be used to disable this optimization. |
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.
-fp-model
precise
option. Likewise, the -ffast-math
option of GCC or clang will significantly degrade the accuracy.typedef Ref<ArrayXr> Eigen::BDCSVD< MatrixType_, Options_ >::ArrayRef |
typedef Array<Index, 1, Dynamic> Eigen::BDCSVD< MatrixType_, Options_ >::ArrayXi |
typedef Array<RealScalar, Dynamic, 1> Eigen::BDCSVD< MatrixType_, Options_ >::ArrayXr |
|
private |
typedef Base::Index Eigen::BDCSVD< MatrixType_, Options_ >::Index |
typedef Ref<ArrayXi> Eigen::BDCSVD< MatrixType_, Options_ >::IndicesRef |
typedef NumTraits<RealScalar>::Literal Eigen::BDCSVD< MatrixType_, Options_ >::Literal |
typedef MatrixType_ Eigen::BDCSVD< MatrixType_, Options_ >::MatrixType |
typedef Base::MatrixUType Eigen::BDCSVD< MatrixType_, Options_ >::MatrixUType |
typedef Base::MatrixVType Eigen::BDCSVD< MatrixType_, Options_ >::MatrixVType |
typedef Matrix<Scalar, Dynamic, Dynamic, ColMajor> Eigen::BDCSVD< MatrixType_, Options_ >::MatrixX |
typedef Matrix<RealScalar, Dynamic, Dynamic, ColMajor> Eigen::BDCSVD< MatrixType_, Options_ >::MatrixXr |
typedef Base::RealScalar Eigen::BDCSVD< MatrixType_, Options_ >::RealScalar |
typedef Base::Scalar Eigen::BDCSVD< MatrixType_, Options_ >::Scalar |
typedef Base::SingularValuesType Eigen::BDCSVD< MatrixType_, Options_ >::SingularValuesType |
typedef Matrix<RealScalar, Dynamic, 1> Eigen::BDCSVD< MatrixType_, Options_ >::VectorType |
anonymous enum |
|
inline |
Default Constructor.
The default constructor is useful in cases in which the user intends to perform decompositions via BDCSVD::compute(const MatrixType&).
|
inline |
Default Constructor with memory preallocation.
Like the default constructor but with preallocation of the internal data according to the specified problem size and Options template parameter.
References Eigen::BDCSVD< MatrixType_, Options_ >::allocate(), Eigen::BDCSVD< MatrixType_, Options_ >::cols(), Eigen::internal::get_computation_options(), Eigen::BDCSVD< MatrixType_, Options_ >::Options, and Eigen::BDCSVD< MatrixType_, Options_ >::rows().
|
inline |
Default Constructor with memory preallocation.
Like the default constructor but with preallocation of the internal data according to the specified problem size and the computationOptions.
One cannot request unitaries using both the Options template parameter and the constructor. If possible, prefer using the Options template parameter.
computationOptions | specification for computing Thin/Full unitaries U/V |
References Eigen::BDCSVD< MatrixType_, Options_ >::allocate(), Eigen::BDCSVD< MatrixType_, Options_ >::cols(), and Eigen::BDCSVD< MatrixType_, Options_ >::rows().
|
inline |
Constructor performing the decomposition of given matrix, using the custom options specified with the Options template parameter.
matrix | the matrix to decompose |
References Eigen::BDCSVD< MatrixType_, Options_ >::compute_impl(), Eigen::internal::get_computation_options(), matrix(), and Eigen::BDCSVD< MatrixType_, Options_ >::Options.
|
inline |
Constructor performing the decomposition of given matrix using specified options for computing unitaries.
One cannot request unitaries using both the Options template parameter and the constructor. If possible, prefer using the Options template parameter.
matrix | the matrix to decompose |
computationOptions | specification for computing Thin/Full unitaries U/V |
References Eigen::BDCSVD< MatrixType_, Options_ >::compute_impl(), and matrix().
|
inline |
|
protected |
References cols, Eigen::DisableQRDecomposition, Eigen::internal::get_computation_options(), max, min, rows, swap(), and oomph::PseudoSolidHelper::Zero.
Referenced by Eigen::BDCSVD< MatrixType_, Options_ >::BDCSVD().
|
inline |
Referenced by gdb.printers._MatrixEntryIterator::__next__(), Eigen::BDCSVD< MatrixType_, Options_ >::BDCSVD(), gdb.printers.EigenMatrixPrinter::children(), gdb.printers.EigenSparseMatrixPrinter::children(), gdb.printers.EigenMatrixPrinter::to_string(), and gdb.printers.EigenSparseMatrixPrinter::to_string().
|
inline |
Method performing the decomposition of given matrix. Computes Thin/Full unitaries U/V if specified using the Options template parameter or the class constructor.
matrix | the matrix to decompose |
References Eigen::BDCSVD< MatrixType_, Options_ >::compute_impl(), Eigen::SVDBase< BDCSVD< MatrixType_, Options_ > >::m_computationOptions, and matrix().
Referenced by bench(), and compare_bdc_jacobi().
|
inline |
Method performing the decomposition of given matrix, as specified by the computationOptions
parameter.
matrix | the matrix to decompose |
computationOptions | specify whether to compute Thin/Full unitaries U/V |
References Eigen::BDCSVD< MatrixType_, Options_ >::compute_impl(), and matrix().
|
private |
References a, abs(), i, Eigen::InvalidInput, Eigen::numext::is_exactly_zero(), Eigen::numext::isfinite(), matrix(), min, Eigen::NoConvergence, and Eigen::Success.
Referenced by Eigen::BDCSVD< MatrixType_, Options_ >::BDCSVD(), and Eigen::BDCSVD< MatrixType_, Options_ >::compute().
|
private |
References n, Eigen::NoConvergence, Eigen::Success, and svd().
|
private |
References a, abs(), actual_n, b, diag, eigen_internal_assert, Eigen::numext::equal_strict(), Eigen::numext::is_exactly_zero(), Eigen::numext::isfinite(), k, max, min, plotDoE::mus, n, sqrt(), Eigen::swap(), and swap().
|
private |
References diag, i, Eigen::numext::is_exactly_zero(), k, m, plotDoE::mus, n, RachelsAdvectionDiffusion::U, and V.
|
private |
References abs(), actual_n, Eigen::placeholders::all, diag, eigen_internal_assert, i, Eigen::numext::is_exactly_zero(), k, m, min, plotDoE::mus, n, Eigen::PlainObjectBase< Derived >::resize(), Eigen::SVDBase< Derived >::singularValues(), Eigen::swap(), swap(), RachelsAdvectionDiffusion::U, and V.
|
private |
|
private |
References abs(), Eigen::placeholders::all, diag, Eigen::Dynamic, eigen_internal_assert, oomph::SarahBL::epsilon, i, J, j, k, max, min, p, constants::pi, sqrt(), Eigen::swap(), and swap().
|
private |
References abs(), calibrate::c, i, Eigen::numext::is_exactly_zero(), J, Eigen::bfloat16_impl::pow(), UniformPSDSelfTest::r, s, size, sqrt(), and oomph::CumulativeTimings::start().
|
private |
References abs(), calibrate::c, conj(), i, Eigen::numext::is_exactly_zero(), J, j, Eigen::bfloat16_impl::pow(), UniformPSDSelfTest::r, s, size, and sqrt().
|
private |
References abs(), Eigen::Aligned, e(), eigen_internal_assert, f(), i, k, lambda, matrix(), min, n, Eigen::NoConvergence, Eigen::bfloat16_impl::pow(), sqrt(), Eigen::Success, tmp, and anonymous_namespace{skew_symmetric_matrix3.cpp}::transpose().
|
private |
References Eigen::numext::abs(), diag, eigen_internal_assert, i, Eigen::numext::is_exactly_zero(), Eigen::numext::isfinite(), j, k, m, plotDoE::mus, n, Eigen::prod(), sqrt(), and tmp.
|
inline |
Referenced by gdb.printers._MatrixEntryIterator::__next__(), Eigen::BDCSVD< MatrixType_, Options_ >::BDCSVD(), gdb.printers.EigenMatrixPrinter::children(), gdb.printers.EigenSparseMatrixPrinter::children(), gdb.printers.EigenMatrixPrinter::to_string(), and gdb.printers.EigenSparseMatrixPrinter::to_string().
|
staticprivate |
|
inline |
References eigen_assert, Eigen::BDCSVD< MatrixType_, Options_ >::m_algoswap, and s.
Referenced by compare_bdc_jacobi().
|
private |
Performs A = A * B exploiting the special structure of the matrix A. Splitting A as: A = [A1] [A2] such that A1.rows()==n1, then we assume that at least half of the columns of A1 and A2 are zeros. We can thus pack them prior to the the matrix product. However, this is only worth the effort if the matrix is large enough.
References j, n, Eigen::PlainObjectBase< Derived >::rows(), and tmp.
|
protected |
|
protected |
|
protected |
Referenced by Eigen::BDCSVD< MatrixType_, Options_ >::setSwitchSize().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
int Eigen::BDCSVD< MatrixType_, Options_ >::m_numIters |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |