14 EIGEN_LAPACK_FUNC(gesdd,(
char *jobz,
int *
m,
int*
n,
Scalar*
a,
int *
lda,
RealScalar *
s,
Scalar *u,
int *ldu,
Scalar *vt,
int *ldvt,
Scalar* ,
int* lwork,
18 bool query_size = *lwork==-1;
22 if(*jobz!=
'A' && *jobz!=
'S' && *jobz!=
'O' && *jobz!=
'N') *info = -1;
23 else if(*m<0) *info = -2;
24 else if(*n<0) *info = -3;
25 else if(*lda<
std::max(1,*m)) *info = -5;
26 else if(*lda<
std::max(1,*m)) *info = -8;
27 else if(*ldu <1 || (*jobz==
'A' && *ldu <*m)
28 || (*jobz==
'O' && *m<*n && *ldu<*
m)) *info = -8;
29 else if(*ldvt<1 || (*jobz==
'A' && *ldvt<*n)
30 || (*jobz==
'S' && *ldvt<diag_size)
31 || (*jobz==
'O' && *m>=*n && *ldvt<*n)) *info = -10;
49 mat =
matrix(a,*m,*n,*lda);
70 else if(*jobz==
'O' && *m>=*n)
85 EIGEN_LAPACK_FUNC(gesvd,(
char *jobu,
char *jobv,
int *m,
int* n,
Scalar* a,
int *lda,
RealScalar *s,
Scalar *u,
int *ldu,
Scalar *vt,
int *ldvt,
Scalar* ,
int* lwork,
89 bool query_size = *lwork==-1;
93 if( *jobu!=
'A' && *jobu!=
'S' && *jobu!=
'O' && *jobu!=
'N') *info = -1;
94 else if((*jobv!=
'A' && *jobv!=
'S' && *jobv!=
'O' && *jobv!=
'N')
95 || (*jobu==
'O' && *jobv==
'O')) *info = -2;
96 else if(*m<0) *info = -3;
97 else if(*n<0) *info = -4;
98 else if(*lda<
std::max(1,*m)) *info = -6;
99 else if(*ldu <1 || ((*jobu==
'A' || *jobu==
'S') && *ldu<*
m)) *info = -9;
100 else if(*ldvt<1 || (*jobv==
'A' && *ldvt<*n)
101 || (*jobv==
'S' && *ldvt<diag_size)) *info = -11;
119 mat =
matrix(a,*m,*n,*lda);
129 else if(*jobu==
'S')
matrix(u,*m,diag_size,*ldu) = svd.
matrixU();
130 else if(*jobu==
'O')
matrix(a,*m,diag_size,*lda) = svd.
matrixU();
133 if(*jobv==
'A')
matrix(vt,*n,*n,*ldvt) = svd.
matrixV().adjoint();
134 else if(*jobv==
'S')
matrix(vt,diag_size,*n,*ldvt) = svd.
matrixV().adjoint();
135 else if(*jobv==
'O')
matrix(a,diag_size,*n,*lda) = svd.
matrixV().adjoint();
cout<< "Here is the matrix m:"<< endl<< m<< endl;JacobiSVD< MatrixXf > svd(m, ComputeThinU|ComputeThinV)
#define EIGEN_LAPACK_ARG_IF_COMPLEX(X)
const MatrixUType & matrixU() const
EIGEN_LAPACK_FUNC(gesdd,(char *jobz, int *m, int *n, Scalar *a, int *lda, RealScalar *s, Scalar *u, int *ldu, Scalar *vt, int *ldvt, Scalar *, int *lwork, EIGEN_LAPACK_ARG_IF_COMPLEX(RealScalar *) int *, int *info))
EIGEN_WEAK_LINKING int xerbla_(const char *msg, int *info, int)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
NumTraits< Scalar >::Real RealScalar
class Bidiagonal Divide and Conquer SVD
Map< Matrix< T, Dynamic, 1 >, 0, InnerStride< Dynamic > > make_vector(T *data, int size, int incr)
Two-sided Jacobi SVD decomposition of a rectangular matrix.
const SingularValuesType & singularValues() const
const MatrixVType & matrixV() const
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
The matrix class, also used for vectors and row-vectors.