mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-08 09:49:03 +08:00
Fix JacobiSVD_LAPACKE bindings
This commit is contained in:
parent
d0b1aef6f6
commit
c9ff739af1
@ -42,12 +42,13 @@ 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<> inline \
|
template<> inline \
|
||||||
JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>& \
|
JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>& \
|
||||||
JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>::compute(const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>& matrix) \
|
JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTIONS>::compute_impl(const Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>& matrix, \
|
||||||
|
unsigned int computationOptions) \
|
||||||
{ \
|
{ \
|
||||||
typedef Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic> MatrixType; \
|
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()); \
|
allocate(matrix.rows(), matrix.cols(), computationOptions); \
|
||||||
\
|
\
|
||||||
/*const RealScalar precision = RealScalar(2) * NumTraits<Scalar>::epsilon();*/ \
|
/*const RealScalar precision = RealScalar(2) * NumTraits<Scalar>::epsilon();*/ \
|
||||||
m_nonzeroSingularValues = m_diagSize; \
|
m_nonzeroSingularValues = m_diagSize; \
|
||||||
@ -56,14 +57,14 @@ JacobiSVD<Matrix<EIGTYPE, Dynamic, Dynamic, EIGCOLROW, Dynamic, Dynamic>, OPTION
|
|||||||
lapack_int matrix_order = LAPACKE_COLROW; \
|
lapack_int matrix_order = LAPACKE_COLROW; \
|
||||||
char jobu, jobvt; \
|
char jobu, jobvt; \
|
||||||
LAPACKE_TYPE *u, *vt, dummy; \
|
LAPACKE_TYPE *u, *vt, dummy; \
|
||||||
jobu = (ShouldComputeFullU) ? 'A' : (ShouldComputeThinU) ? 'S' : 'N'; \
|
jobu = (m_computeFullU) ? 'A' : (m_computeThinU) ? 'S' : 'N'; \
|
||||||
jobvt = (ShouldComputeFullV) ? 'A' : (ShouldComputeThinV) ? 'S' : 'N'; \
|
jobvt = (m_computeFullV) ? 'A' : (m_computeThinV) ? 'S' : 'N'; \
|
||||||
if (computeU()) { \
|
if (computeU()) { \
|
||||||
ldu = internal::convert_index<lapack_int>(m_matrixU.outerStride()); \
|
ldu = internal::convert_index<lapack_int>(m_matrixU.outerStride()); \
|
||||||
u = (LAPACKE_TYPE*)m_matrixU.data(); \
|
u = (LAPACKE_TYPE*)m_matrixU.data(); \
|
||||||
} else { ldu=1; u=&dummy; }\
|
} else { ldu=1; u=&dummy; }\
|
||||||
MatrixType localV; \
|
MatrixType localV; \
|
||||||
lapack_int vt_rows = (ShouldComputeFullV) ? internal::convert_index<lapack_int>(m_cols) : (ShouldComputeThinV) ? internal::convert_index<lapack_int>(m_diagSize) : 1; \
|
lapack_int vt_rows = (m_computeFullV) ? internal::convert_index<lapack_int>(m_cols) : (m_computeThinV) ? internal::convert_index<lapack_int>(m_diagSize) : 1; \
|
||||||
if (computeV()) { \
|
if (computeV()) { \
|
||||||
localV.resize(vt_rows, m_cols); \
|
localV.resize(vt_rows, m_cols); \
|
||||||
ldvt = internal::convert_index<lapack_int>(localV.outerStride()); \
|
ldvt = internal::convert_index<lapack_int>(localV.outerStride()); \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user