33 #ifndef EIGEN_JACOBISVD_LAPACKE_H 34 #define EIGEN_JACOBISVD_LAPACKE_H 37 #include "./InternalHeaderCheck.h" 43 #define EIGEN_LAPACKE_SVD(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_PREFIX, EIGCOLROW, LAPACKE_COLROW, OPTIONS) \ 45 template <typename Derived> \ 46 inline JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>& \ 47 JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>::compute_impl( \ 48 const MatrixBase<Derived>& matrix, unsigned int computationOptions) { \ 51 allocate(matrix.rows(), matrix.cols(), computationOptions); \ 54 m_nonzeroSingularValues = diagSize(); \ 56 lapack_int lda = internal::convert_index<lapack_int>(matrix.outerStride()), ldu, ldvt; \ 57 lapack_int matrix_order = LAPACKE_COLROW; \ 59 LAPACKE_TYPE *u, *vt, dummy; \ 60 jobu = (m_computeFullU) ? 'A' : (m_computeThinU) ? 'S' : 'N'; \ 61 jobvt = (m_computeFullV) ? 'A' : (m_computeThinV) ? 'S' : 'N'; \ 63 ldu = internal::convert_index<lapack_int>(m_matrixU.outerStride()); \ 64 u = (LAPACKE_TYPE*)m_matrixU.data(); \ 70 lapack_int vt_rows = (m_computeFullV) ? internal::convert_index<lapack_int>(cols()) \ 71 : (m_computeThinV) ? internal::convert_index<lapack_int>(diagSize()) \ 74 localV.resize(vt_rows, cols()); \ 75 ldvt = internal::convert_index<lapack_int>(localV.outerStride()); \ 76 vt = (LAPACKE_TYPE*)localV.data(); \ 81 Matrix<LAPACKE_RTYPE, Dynamic, Dynamic> superb; \ 82 superb.resize(diagSize(), 1); \ 85 lapack_int info = LAPACKE_##LAPACKE_PREFIX##gesvd( \ 86 matrix_order, jobu, jobvt, internal::convert_index<lapack_int>(rows()), \ 87 internal::convert_index<lapack_int>(cols()), (LAPACKE_TYPE*)m_temp.data(), lda, \ 88 (LAPACKE_RTYPE*)m_singularValues.data(), u, ldu, vt, ldvt, superb.data()); \ 90 if (info < 0 || !m_singularValues.allFinite()) { \ 91 m_info = InvalidInput; \ 92 } else if (info > 0) { \ 93 m_info = NoConvergence; \ 96 if (computeV()) m_matrixV = localV.adjoint(); \ 100 m_isInitialized = true; \ 104 #define EIGEN_LAPACK_SVD_OPTIONS(OPTIONS) \ 105 EIGEN_LAPACKE_SVD(double, double, double, d, ColMajor, LAPACK_COL_MAJOR, OPTIONS) \ 106 EIGEN_LAPACKE_SVD(float, float, float, s, ColMajor, LAPACK_COL_MAJOR, OPTIONS) \ 107 EIGEN_LAPACKE_SVD(dcomplex, lapack_complex_double, double, z, ColMajor, LAPACK_COL_MAJOR, OPTIONS) \ 108 EIGEN_LAPACKE_SVD(scomplex, lapack_complex_float, float, c, ColMajor, LAPACK_COL_MAJOR, OPTIONS) \ 110 EIGEN_LAPACKE_SVD(double, double, double, d, RowMajor, LAPACK_ROW_MAJOR, OPTIONS) \ 111 EIGEN_LAPACKE_SVD(float, float, float, s, RowMajor, LAPACK_ROW_MAJOR, OPTIONS) \ 112 EIGEN_LAPACKE_SVD(dcomplex, lapack_complex_double, double, z, RowMajor, LAPACK_ROW_MAJOR, OPTIONS) \ 113 EIGEN_LAPACKE_SVD(scomplex, lapack_complex_float, float, c, RowMajor, LAPACK_ROW_MAJOR, OPTIONS) 115 EIGEN_LAPACK_SVD_OPTIONS(0)
127 #endif // EIGEN_JACOBISVD_LAPACKE_H Definition: Constants.h:389
Definition: Constants.h:395
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
Definition: Constants.h:393
Definition: Constants.h:391