mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-01 14:10:52 +08:00
Fix: Correct Lapacke bindings for BDCSVD and JacobiSVD to match the updated API
This commit is contained in:
parent
434a2fc4a4
commit
f3e7d64f3d
@ -182,7 +182,9 @@ class BDCSVD : public SVDBase<BDCSVD<MatrixType_, Options_> > {
|
|||||||
* \deprecated Will be removed in the next major Eigen version. Options should
|
* \deprecated Will be removed in the next major Eigen version. Options should
|
||||||
* be specified in the \a Options template parameter.
|
* be specified in the \a Options template parameter.
|
||||||
*/
|
*/
|
||||||
EIGEN_DEPRECATED BDCSVD(const MatrixType& matrix, unsigned int computationOptions) : m_algoswap(16), m_numIters(0) {
|
template <typename Derived>
|
||||||
|
EIGEN_DEPRECATED BDCSVD(const MatrixBase<Derived>& matrix, unsigned int computationOptions)
|
||||||
|
: m_algoswap(16), m_numIters(0) {
|
||||||
internal::check_svd_options_assertions<MatrixType, Options>(computationOptions, matrix.rows(), matrix.cols());
|
internal::check_svd_options_assertions<MatrixType, Options>(computationOptions, matrix.rows(), matrix.cols());
|
||||||
compute_impl(matrix, computationOptions);
|
compute_impl(matrix, computationOptions);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,8 @@ class BDCSVD_LAPACKE : public BDCSVD<MatrixType_, Options> {
|
|||||||
// construct this by moving from a parent object
|
// construct this by moving from a parent object
|
||||||
BDCSVD_LAPACKE(SVD&& svd) : SVD(std::move(svd)) {}
|
BDCSVD_LAPACKE(SVD&& svd) : SVD(std::move(svd)) {}
|
||||||
|
|
||||||
void compute_impl_lapacke(const MatrixType& matrix, unsigned int computationOptions) {
|
template <typename Derived>
|
||||||
|
void compute_impl_lapacke(const MatrixBase<Derived>& matrix, unsigned int computationOptions) {
|
||||||
SVD::allocate(matrix.rows(), matrix.cols(), computationOptions);
|
SVD::allocate(matrix.rows(), matrix.cols(), computationOptions);
|
||||||
|
|
||||||
SVD::m_nonzeroSingularValues = SVD::m_diagSize;
|
SVD::m_nonzeroSingularValues = SVD::m_diagSize;
|
||||||
@ -120,8 +121,8 @@ class BDCSVD_LAPACKE : public BDCSVD<MatrixType_, Options> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename MatrixType_, int Options>
|
template <typename MatrixType_, int Options, typename Derived>
|
||||||
BDCSVD<MatrixType_, Options>& BDCSVD_wrapper(BDCSVD<MatrixType_, Options>& svd, const MatrixType_& matrix,
|
BDCSVD<MatrixType_, Options>& BDCSVD_wrapper(BDCSVD<MatrixType_, Options>& svd, const MatrixBase<Derived>& matrix,
|
||||||
int computationOptions) {
|
int computationOptions) {
|
||||||
// we need to move to the wrapper type and back
|
// we need to move to the wrapper type and back
|
||||||
BDCSVD_LAPACKE<MatrixType_, Options> tmpSvd(std::move(svd));
|
BDCSVD_LAPACKE<MatrixType_, Options> tmpSvd(std::move(svd));
|
||||||
@ -136,9 +137,10 @@ BDCSVD<MatrixType_, Options>& BDCSVD_wrapper(BDCSVD<MatrixType_, Options>& svd,
|
|||||||
|
|
||||||
#define EIGEN_LAPACKE_SDD(EIGTYPE, EIGCOLROW, OPTIONS) \
|
#define EIGEN_LAPACKE_SDD(EIGTYPE, EIGCOLROW, OPTIONS) \
|
||||||
template <> \
|
template <> \
|
||||||
|
template <typename Derived> \
|
||||||
inline BDCSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>& \
|
inline BDCSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>& \
|
||||||
BDCSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>::compute_impl( \
|
BDCSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>::compute_impl( \
|
||||||
const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>& matrix, unsigned int computationOptions) { \
|
const MatrixBase<Derived>& matrix, unsigned int computationOptions) { \
|
||||||
return internal::lapacke_helpers::BDCSVD_wrapper(*this, matrix, computationOptions); \
|
return internal::lapacke_helpers::BDCSVD_wrapper(*this, matrix, computationOptions); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,10 +42,10 @@ namespace Eigen {
|
|||||||
|
|
||||||
#define EIGEN_LAPACKE_SVD(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_PREFIX, EIGCOLROW, LAPACKE_COLROW, OPTIONS) \
|
#define EIGEN_LAPACKE_SVD(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_PREFIX, EIGCOLROW, LAPACKE_COLROW, OPTIONS) \
|
||||||
template <> \
|
template <> \
|
||||||
|
template <typename Derived> \
|
||||||
inline JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>& \
|
inline JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>& \
|
||||||
JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>::compute_impl( \
|
JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>::compute_impl( \
|
||||||
const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>& matrix, unsigned int computationOptions) { \
|
const MatrixBase<Derived>& matrix, unsigned int computationOptions) { \
|
||||||
typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> MatrixType; \
|
|
||||||
/*typedef MatrixType::Scalar Scalar;*/ \
|
/*typedef MatrixType::Scalar Scalar;*/ \
|
||||||
/*typedef MatrixType::RealScalar RealScalar;*/ \
|
/*typedef MatrixType::RealScalar RealScalar;*/ \
|
||||||
allocate(matrix.rows(), matrix.cols(), computationOptions); \
|
allocate(matrix.rows(), matrix.cols(), computationOptions); \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user