mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-05-22 04:27:36 +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>
|
template<int Options = 0>
|
||||||
inline JacobiSVD<PlainObject, Options> jacobiSvd() const;
|
inline JacobiSVD<PlainObject, Options> jacobiSvd() const;
|
||||||
template<int Options = 0>
|
template<int Options = 0>
|
||||||
|
EIGEN_DEPRECATED
|
||||||
inline JacobiSVD<PlainObject, Options> jacobiSvd(unsigned int computationOptions) const;
|
inline JacobiSVD<PlainObject, Options> jacobiSvd(unsigned int computationOptions) const;
|
||||||
|
|
||||||
template<int Options = 0>
|
template<int Options = 0>
|
||||||
inline BDCSVD<PlainObject, Options> bdcSvd() const;
|
inline BDCSVD<PlainObject, Options> bdcSvd() const;
|
||||||
template<int Options = 0>
|
template<int Options = 0>
|
||||||
|
EIGEN_DEPRECATED
|
||||||
inline BDCSVD<PlainObject, Options> bdcSvd(unsigned int computationOptions) const;
|
inline BDCSVD<PlainObject, Options> bdcSvd(unsigned int computationOptions) const;
|
||||||
|
|
||||||
/////////// Geometry module ///////////
|
/////////// Geometry module ///////////
|
||||||
|
@ -152,15 +152,18 @@ public:
|
|||||||
* Like the default constructor but with preallocation of the internal data
|
* Like the default constructor but with preallocation of the internal data
|
||||||
* according to the specified problem size and the \a computationOptions.
|
* 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
|
* One \b cannot request unitiaries using both the \a Options template parameter
|
||||||
* and the constructor. If possible, prefer using 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
|
* \param computationOptions specifification for computing Thin/Full unitaries U/V
|
||||||
* \sa BDCSVD()
|
* \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) {
|
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);
|
allocate(rows, cols, computationOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,15 +179,18 @@ public:
|
|||||||
/** \brief Constructor performing the decomposition of given matrix using specified options
|
/** \brief Constructor performing the decomposition of given matrix using specified options
|
||||||
* for computing unitaries.
|
* for computing unitaries.
|
||||||
*
|
*
|
||||||
* <b>Note: This constructor is deprecated.</b>
|
|
||||||
* One \b cannot request unitiaries using both the \a Options template parameter
|
* One \b cannot request unitiaries using both the \a Options template parameter
|
||||||
* and the constructor. If possible, prefer using the \a Options template parameter.
|
* and the constructor. If possible, prefer using the \a Options template parameter.
|
||||||
*
|
*
|
||||||
* \param matrix the matrix to decompose
|
* \param matrix the matrix to decompose
|
||||||
* \param computationOptions specifification for computing Thin/Full unitaries U/V
|
* \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) {
|
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);
|
compute_impl(matrix, computationOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,6 +202,21 @@ public:
|
|||||||
* \param matrix the matrix to decompose
|
* \param matrix the matrix to decompose
|
||||||
*/
|
*/
|
||||||
BDCSVD& compute(const MatrixType& matrix) { return compute_impl(matrix, m_computationOptions); }
|
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)
|
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
|
* Like the default constructor but with preallocation of the internal data
|
||||||
* according to the specified problem size.
|
* 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.
|
* and the constructor. If possible, prefer using the \a Options template parameter.
|
||||||
*
|
*
|
||||||
* \param computationOptions specify whether to compute Thin/Full unitaries U/V
|
* \param computationOptions specify whether to compute Thin/Full unitaries U/V
|
||||||
* \sa JacobiSVD()
|
* \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) {
|
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);
|
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
|
/** \brief Constructor performing the decomposition of given matrix using specified options
|
||||||
* for computing unitaries.
|
* for computing unitaries.
|
||||||
*
|
*
|
||||||
* <b>Note: This constructor is deprecated.</b>
|
|
||||||
* One \b cannot request unitiaries using both the \a Options template parameter
|
* One \b cannot request unitiaries using both the \a Options template parameter
|
||||||
* and the constructor. If possible, prefer using the \a Options template parameter.
|
* and the constructor. If possible, prefer using the \a Options template parameter.
|
||||||
*
|
*
|
||||||
* \param matrix the matrix to decompose
|
* \param matrix the matrix to decompose
|
||||||
* \param computationOptions specify whether to compute Thin/Full unitaries U/V
|
* \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) {
|
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);
|
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); }
|
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::computeU;
|
||||||
using Base::computeV;
|
using Base::computeV;
|
||||||
using Base::rows;
|
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; }
|
constexpr int should_svd_compute_full_v(int options) { return options & ComputeFullV; }
|
||||||
|
|
||||||
template <typename MatrixType, int Options>
|
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,
|
EIGEN_STATIC_ASSERT((Options & ComputationOptionsBits) == 0,
|
||||||
"SVDBase: Cannot request U or V using both static and runtime options, even if they match. "
|
"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: "
|
"Requesting unitaries at runtime is DEPRECATED: "
|
||||||
"If possible, prefer requesting unitaries statically, using the Options template parameter.");
|
"Prefer requesting unitaries statically, using the Options template parameter.");
|
||||||
eigen_assert(
|
eigen_assert(
|
||||||
!(should_svd_compute_thin_u(computationOptions) && MatrixType::ColsAtCompileTime != Dynamic) &&
|
!(should_svd_compute_thin_u(computationOptions) && MatrixType::ColsAtCompileTime != Dynamic) &&
|
||||||
!(should_svd_compute_thin_v(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.");
|
"your matrix has a dynamic number of columns.");
|
||||||
(void)computationOptions;
|
(void)computationOptions;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user