mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-05-21 20:17:35 +08:00
Re-add svd::compute(Matrix, options)
method to avoid breaking external projects.
This commit is contained in:
parent
a58af20d61
commit
766087329e
@ -373,11 +373,13 @@ template<typename Derived> class MatrixBase
|
||||
template<int Options = 0>
|
||||
inline JacobiSVD<PlainObject, Options> jacobiSvd() const;
|
||||
template<int Options = 0>
|
||||
EIGEN_DEPRECATED
|
||||
inline JacobiSVD<PlainObject, Options> jacobiSvd(unsigned int computationOptions) const;
|
||||
|
||||
template<int Options = 0>
|
||||
inline BDCSVD<PlainObject, Options> bdcSvd() const;
|
||||
template<int Options = 0>
|
||||
EIGEN_DEPRECATED
|
||||
inline BDCSVD<PlainObject, Options> bdcSvd(unsigned int computationOptions) const;
|
||||
|
||||
/////////// Geometry module ///////////
|
||||
|
@ -152,15 +152,18 @@ public:
|
||||
* Like the default constructor but with preallocation of the internal data
|
||||
* according to the specified problem size and the \a computationOptions.
|
||||
*
|
||||
* <b>Note: This constructor is deprecated.</b>
|
||||
* One \b cannot request unitiaries using both the \a Options template parameter
|
||||
* and the constructor. If possible, prefer using the \a Options template parameter.
|
||||
*
|
||||
* \param computationOptions specifification for computing Thin/Full unitaries U/V
|
||||
* \sa BDCSVD()
|
||||
*
|
||||
* \deprecated Will be removed in the next major Eigen version. Options should
|
||||
* be specified in the \a Options template parameter.
|
||||
*/
|
||||
EIGEN_DEPRECATED
|
||||
BDCSVD(Index rows, Index cols, unsigned int computationOptions) : m_algoswap(16), m_numIters(0) {
|
||||
internal::check_svd_constructor_assertions<MatrixType, Options>(computationOptions);
|
||||
internal::check_svd_options_assertions<MatrixType, Options>(computationOptions);
|
||||
allocate(rows, cols, computationOptions);
|
||||
}
|
||||
|
||||
@ -176,15 +179,18 @@ public:
|
||||
/** \brief Constructor performing the decomposition of given matrix using specified options
|
||||
* for computing unitaries.
|
||||
*
|
||||
* <b>Note: This constructor is deprecated.</b>
|
||||
* One \b cannot request unitiaries using both the \a Options template parameter
|
||||
* and the constructor. If possible, prefer using the \a Options template parameter.
|
||||
*
|
||||
* \param matrix the matrix to decompose
|
||||
* \param computationOptions specifification for computing Thin/Full unitaries U/V
|
||||
*
|
||||
* \deprecated Will be removed in the next major Eigen version. Options should
|
||||
* be specified in the \a Options template parameter.
|
||||
*/
|
||||
EIGEN_DEPRECATED
|
||||
BDCSVD(const MatrixType& matrix, unsigned int computationOptions) : m_algoswap(16), m_numIters(0) {
|
||||
internal::check_svd_constructor_assertions<MatrixType, Options>(computationOptions);
|
||||
internal::check_svd_options_assertions<MatrixType, Options>(computationOptions);
|
||||
compute_impl(matrix, computationOptions);
|
||||
}
|
||||
|
||||
@ -196,6 +202,21 @@ public:
|
||||
* \param matrix the matrix to decompose
|
||||
*/
|
||||
BDCSVD& compute(const MatrixType& matrix) { return compute_impl(matrix, m_computationOptions); }
|
||||
|
||||
/** \brief Method performing the decomposition of given matrix, as specified by
|
||||
* the `computationOptions` parameter.
|
||||
*
|
||||
* \param matrix the matrix to decompose
|
||||
* \param computationOptions specify whether to compute Thin/Full unitaries U/V
|
||||
*
|
||||
* \deprecated Will be removed in the next major Eigen version. Options should
|
||||
* be specified in the \a Options template parameter.
|
||||
*/
|
||||
EIGEN_DEPRECATED
|
||||
BDCSVD& compute(const MatrixType& matrix, unsigned int computationOptions) {
|
||||
internal::check_svd_options_assertions<MatrixType, Options>(computationOptions);
|
||||
return compute_impl(matrix, computationOptions);
|
||||
}
|
||||
|
||||
void setSwitchSize(int s)
|
||||
{
|
||||
|
@ -557,15 +557,18 @@ class JacobiSVD : public SVDBase<JacobiSVD<MatrixType_, Options> > {
|
||||
* Like the default constructor but with preallocation of the internal data
|
||||
* according to the specified problem size.
|
||||
*
|
||||
* <b>Note: This constructor is deprecated.</b>
|
||||
* one \b cannot request unitaries using both the \a Options template parameter
|
||||
* One \b cannot request unitaries using both the \a Options template parameter
|
||||
* and the constructor. If possible, prefer using the \a Options template parameter.
|
||||
*
|
||||
* \param computationOptions specify whether to compute Thin/Full unitaries U/V
|
||||
* \sa JacobiSVD()
|
||||
*
|
||||
* \deprecated Will be removed in the next major Eigen version. Options should
|
||||
* be specified in the \a Options template parameter.
|
||||
*/
|
||||
EIGEN_DEPRECATED
|
||||
JacobiSVD(Index rows, Index cols, unsigned int computationOptions) {
|
||||
internal::check_svd_constructor_assertions<MatrixType, Options>(computationOptions);
|
||||
internal::check_svd_options_assertions<MatrixType, Options>(computationOptions);
|
||||
allocate(rows, cols, computationOptions);
|
||||
}
|
||||
|
||||
@ -579,15 +582,18 @@ class JacobiSVD : public SVDBase<JacobiSVD<MatrixType_, Options> > {
|
||||
/** \brief Constructor performing the decomposition of given matrix using specified options
|
||||
* for computing unitaries.
|
||||
*
|
||||
* <b>Note: This constructor is deprecated.</b>
|
||||
* One \b cannot request unitiaries using both the \a Options template parameter
|
||||
* and the constructor. If possible, prefer using the \a Options template parameter.
|
||||
*
|
||||
* \param matrix the matrix to decompose
|
||||
* \param computationOptions specify whether to compute Thin/Full unitaries U/V
|
||||
*
|
||||
* \deprecated Will be removed in the next major Eigen version. Options should
|
||||
* be specified in the \a Options template parameter.
|
||||
*/
|
||||
EIGEN_DEPRECATED
|
||||
JacobiSVD(const MatrixType& matrix, unsigned int computationOptions) {
|
||||
internal::check_svd_constructor_assertions<MatrixType, Options>(computationOptions);
|
||||
internal::check_svd_options_assertions<MatrixType, Options>(computationOptions);
|
||||
compute_impl(matrix, computationOptions);
|
||||
}
|
||||
|
||||
@ -598,6 +604,21 @@ class JacobiSVD : public SVDBase<JacobiSVD<MatrixType_, Options> > {
|
||||
*/
|
||||
JacobiSVD& compute(const MatrixType& matrix) { return compute_impl(matrix, m_computationOptions); }
|
||||
|
||||
/** \brief Method performing the decomposition of given matrix, as specified by
|
||||
* the `computationOptions` parameter.
|
||||
*
|
||||
* \param matrix the matrix to decompose
|
||||
* \param computationOptions specify whether to compute Thin/Full unitaries U/V
|
||||
*
|
||||
* \deprecated Will be removed in the next major Eigen version. Options should
|
||||
* be specified in the \a Options template parameter.
|
||||
*/
|
||||
EIGEN_DEPRECATED
|
||||
JacobiSVD& compute(const MatrixType& matrix, unsigned int computationOptions) {
|
||||
internal::check_svd_options_assertions<MatrixType, Options>(m_computationOptions);
|
||||
return compute_impl(matrix, computationOptions);
|
||||
}
|
||||
|
||||
using Base::computeU;
|
||||
using Base::computeV;
|
||||
using Base::rows;
|
||||
|
@ -38,15 +38,15 @@ constexpr int should_svd_compute_thin_v(int options) { return options & ComputeT
|
||||
constexpr int should_svd_compute_full_v(int options) { return options & ComputeFullV; }
|
||||
|
||||
template <typename MatrixType, int Options>
|
||||
void check_svd_constructor_assertions(unsigned int computationOptions) {
|
||||
void check_svd_options_assertions(unsigned int computationOptions) {
|
||||
EIGEN_STATIC_ASSERT((Options & ComputationOptionsBits) == 0,
|
||||
"SVDBase: Cannot request U or V using both static and runtime options, even if they match. "
|
||||
"Requesting unitaries at runtime through the constructor is DEPRECATED: "
|
||||
"If possible, prefer requesting unitaries statically, using the Options template parameter.");
|
||||
"Requesting unitaries at runtime is DEPRECATED: "
|
||||
"Prefer requesting unitaries statically, using the Options template parameter.");
|
||||
eigen_assert(
|
||||
!(should_svd_compute_thin_u(computationOptions) && MatrixType::ColsAtCompileTime != Dynamic) &&
|
||||
!(should_svd_compute_thin_v(computationOptions) && MatrixType::ColsAtCompileTime != Dynamic) &&
|
||||
"SVDBase: If U or V are requested at runtime through the constructor, then thin U and V are only available when "
|
||||
"SVDBase: If U or V are requested at runtime, then thin U and V are only available when "
|
||||
"your matrix has a dynamic number of columns.");
|
||||
(void)computationOptions;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user