38 #ifndef EIGEN_BDCSVD_LAPACKE_H
39 #define EIGEN_BDCSVD_LAPACKE_H
45 namespace lapacke_helpers {
50 template <
typename MatrixType_,
int Options>
51 class BDCSVD_LAPACKE :
public BDCSVD<MatrixType_, Options> {
52 typedef BDCSVD<MatrixType_, Options> SVD;
59 BDCSVD_LAPACKE(SVD&&
svd) : SVD(
std::move(
svd)) {}
61 void compute_impl_lapacke(
const MatrixType& matrix,
unsigned int computationOptions) {
63 SVD::allocate(matrix.rows(), matrix.cols(), computationOptions);
68 const lapack_int matrix_order = lapack_storage_of(matrix);
73 Scalar *u, *vt, dummy;
80 ldu = to_lapack(localU.outerStride());
82 }
else { ldu=1; u=&dummy; }
86 ldvt = to_lapack(localV.outerStride());
88 }
else { ldvt=1; vt=&dummy; }
94 to_lapack(u), ldu, to_lapack(vt), ldvt);
100 }
else if (info > 0 ) {
115 template<
typename MatrixType_,
int Options>
116 BDCSVD<MatrixType_, Options>& BDCSVD_wrapper(BDCSVD<MatrixType_, Options>&
svd,
const MatrixType_& matrix,
int computationOptions)
119 BDCSVD_LAPACKE<MatrixType_, Options> tmpSvd(std::move(
svd));
120 tmpSvd.compute_impl_lapacke(matrix, computationOptions);
121 svd = std::move(tmpSvd);
129 #define EIGEN_LAPACKE_SDD(EIGTYPE, EIGCOLROW, OPTIONS) \
131 BDCSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>& \
132 BDCSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>::compute_impl(const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>& matrix, unsigned int computationOptions) {\
133 return internal::lapacke_helpers::BDCSVD_wrapper(*this, matrix, computationOptions); \
136 #define EIGEN_LAPACK_SDD_OPTIONS(OPTIONS) \
137 EIGEN_LAPACKE_SDD(double, ColMajor, OPTIONS) \
138 EIGEN_LAPACKE_SDD(float, ColMajor, OPTIONS) \
139 EIGEN_LAPACKE_SDD(dcomplex, ColMajor, OPTIONS) \
140 EIGEN_LAPACKE_SDD(scomplex, ColMajor, OPTIONS) \
142 EIGEN_LAPACKE_SDD(double, RowMajor, OPTIONS) \
143 EIGEN_LAPACKE_SDD(float, RowMajor, OPTIONS) \
144 EIGEN_LAPACKE_SDD(dcomplex, RowMajor, OPTIONS) \
145 EIGEN_LAPACKE_SDD(scomplex, RowMajor, OPTIONS)
157 #undef EIGEN_LAPACK_SDD_OPTIONS
159 #undef EIGEN_LAPACKE_SDD
#define EIGEN_LAPACK_SDD_OPTIONS(OPTIONS)
cout<< "Here is the matrix m:"<< endl<< m<< endl;JacobiSVD< MatrixXf, ComputeThinU|ComputeThinV > svd(m)
Matrix< float, 1, Dynamic > MatrixType
void allocate(Index rows, Index cols, unsigned int computationOptions)
Base::RealScalar RealScalar
const AdjointReturnType adjoint() const
const Scalar * data() const
ComputationInfo info() const
Reports whether previous computation was successful.
Index m_nonzeroSingularValues
SingularValuesType m_singularValues