Remove return int types from BLAS/LAPACK functions.

This commit is contained in:
Antonio Sánchez
2024-02-14 19:51:36 +00:00
parent 7e655c9a5d
commit 5361dea833
38 changed files with 888 additions and 1010 deletions

View File

@@ -11,7 +11,7 @@
#include <Eigen/Cholesky>
// POTRF computes the Cholesky factorization of a real symmetric positive definite matrix A.
EIGEN_LAPACK_FUNC(potrf, (char *uplo, int *n, RealScalar *pa, int *lda, int *info)) {
EIGEN_LAPACK_FUNC(potrf)(char *uplo, int *n, RealScalar *pa, int *lda, int *info) {
*info = 0;
if (UPLO(*uplo) == INVALID)
*info = -1;
@@ -21,7 +21,7 @@ EIGEN_LAPACK_FUNC(potrf, (char *uplo, int *n, RealScalar *pa, int *lda, int *inf
*info = -4;
if (*info != 0) {
int e = -*info;
return xerbla_(SCALAR_SUFFIX_UP "POTRF", &e, 6);
return xerbla_(SCALAR_SUFFIX_UP "POTRF", &e);
}
Scalar *a = reinterpret_cast<Scalar *>(pa);
@@ -33,15 +33,12 @@ EIGEN_LAPACK_FUNC(potrf, (char *uplo, int *n, RealScalar *pa, int *lda, int *inf
ret = int(internal::llt_inplace<Scalar, Lower>::blocked(A));
if (ret >= 0) *info = ret + 1;
return 0;
}
// POTRS solves a system of linear equations A*X = B with a symmetric
// positive definite matrix A using the Cholesky factorization
// A = U**T*U or A = L*L**T computed by DPOTRF.
EIGEN_LAPACK_FUNC(potrs,
(char *uplo, int *n, int *nrhs, RealScalar *pa, int *lda, RealScalar *pb, int *ldb, int *info)) {
EIGEN_LAPACK_FUNC(potrs)(char *uplo, int *n, int *nrhs, RealScalar *pa, int *lda, RealScalar *pb, int *ldb, int *info) {
*info = 0;
if (UPLO(*uplo) == INVALID)
*info = -1;
@@ -55,7 +52,7 @@ EIGEN_LAPACK_FUNC(potrs,
*info = -7;
if (*info != 0) {
int e = -*info;
return xerbla_(SCALAR_SUFFIX_UP "POTRS", &e, 6);
return xerbla_(SCALAR_SUFFIX_UP "POTRS", &e);
}
Scalar *a = reinterpret_cast<Scalar *>(pa);
@@ -70,6 +67,4 @@ EIGEN_LAPACK_FUNC(potrs,
A.triangularView<Lower>().solveInPlace(B);
A.triangularView<Lower>().adjoint().solveInPlace(B);
}
return 0;
}

View File

@@ -11,8 +11,8 @@
#include <Eigen/Eigenvalues>
// computes eigen values and vectors of a general N-by-N matrix A
EIGEN_LAPACK_FUNC(syev, (char* jobz, char* uplo, int* n, Scalar* a, int* lda, Scalar* w, Scalar* /*work*/, int* lwork,
int* info)) {
EIGEN_LAPACK_FUNC(syev)
(char* jobz, char* uplo, int* n, Scalar* a, int* lda, Scalar* w, Scalar* /*work*/, int* lwork, int* info) {
// TODO exploit the work buffer
bool query_size = *lwork == -1;
@@ -30,15 +30,15 @@ EIGEN_LAPACK_FUNC(syev, (char* jobz, char* uplo, int* n, Scalar* a, int* lda, Sc
if (*info != 0) {
int e = -*info;
return xerbla_(SCALAR_SUFFIX_UP "SYEV ", &e, 6);
return xerbla_(SCALAR_SUFFIX_UP "SYEV ", &e);
}
if (query_size) {
*lwork = 0;
return 0;
return;
}
if (*n == 0) return 0;
if (*n == 0) return;
PlainMatrixType mat(*n, *n);
if (UPLO(*uplo) == UP)
@@ -53,11 +53,9 @@ EIGEN_LAPACK_FUNC(syev, (char* jobz, char* uplo, int* n, Scalar* a, int* lda, Sc
make_vector(w, *n).setZero();
if (computeVectors) matrix(a, *n, *n, *lda).setIdentity();
//*info = 1;
return 0;
return;
}
make_vector(w, *n) = eig.eigenvalues();
if (computeVectors) matrix(a, *n, *n, *lda) = eig.eigenvectors();
return 0;
}

View File

@@ -7,127 +7,127 @@
extern "C" {
#endif
int BLASFUNC(csymv)(const char *, const int *, const float *, const float *, const int *, const float *, const int *,
const float *, float *, const int *);
int BLASFUNC(zsymv)(const char *, const int *, const double *, const double *, const int *, const double *, const int *,
const double *, double *, const int *);
int BLASFUNC(xsymv)(const char *, const int *, const double *, const double *, const int *, const double *, const int *,
const double *, double *, const int *);
void BLASFUNC(csymv)(const char *, const int *, const float *, const float *, const int *, const float *, const int *,
const float *, float *, const int *);
void BLASFUNC(zsymv)(const char *, const int *, const double *, const double *, const int *, const double *,
const int *, const double *, double *, const int *);
void BLASFUNC(xsymv)(const char *, const int *, const double *, const double *, const int *, const double *,
const int *, const double *, double *, const int *);
int BLASFUNC(cspmv)(char *, int *, float *, float *, float *, int *, float *, float *, int *);
int BLASFUNC(zspmv)(char *, int *, double *, double *, double *, int *, double *, double *, int *);
int BLASFUNC(xspmv)(char *, int *, double *, double *, double *, int *, double *, double *, int *);
void BLASFUNC(cspmv)(char *, int *, float *, float *, float *, int *, float *, float *, int *);
void BLASFUNC(zspmv)(char *, int *, double *, double *, double *, int *, double *, double *, int *);
void BLASFUNC(xspmv)(char *, int *, double *, double *, double *, int *, double *, double *, int *);
int BLASFUNC(csyr)(char *, int *, float *, float *, int *, float *, int *);
int BLASFUNC(zsyr)(char *, int *, double *, double *, int *, double *, int *);
int BLASFUNC(xsyr)(char *, int *, double *, double *, int *, double *, int *);
void BLASFUNC(csyr)(char *, int *, float *, float *, int *, float *, int *);
void BLASFUNC(zsyr)(char *, int *, double *, double *, int *, double *, int *);
void BLASFUNC(xsyr)(char *, int *, double *, double *, int *, double *, int *);
int BLASFUNC(cspr)(char *, int *, float *, float *, int *, float *);
int BLASFUNC(zspr)(char *, int *, double *, double *, int *, double *);
int BLASFUNC(xspr)(char *, int *, double *, double *, int *, double *);
void BLASFUNC(cspr)(char *, int *, float *, float *, int *, float *);
void BLASFUNC(zspr)(char *, int *, double *, double *, int *, double *);
void BLASFUNC(xspr)(char *, int *, double *, double *, int *, double *);
int BLASFUNC(sgemt)(char *, int *, int *, float *, float *, int *, float *, int *);
int BLASFUNC(dgemt)(char *, int *, int *, double *, double *, int *, double *, int *);
int BLASFUNC(cgemt)(char *, int *, int *, float *, float *, int *, float *, int *);
int BLASFUNC(zgemt)(char *, int *, int *, double *, double *, int *, double *, int *);
void BLASFUNC(sgemt)(char *, int *, int *, float *, float *, int *, float *, int *);
void BLASFUNC(dgemt)(char *, int *, int *, double *, double *, int *, double *, int *);
void BLASFUNC(cgemt)(char *, int *, int *, float *, float *, int *, float *, int *);
void BLASFUNC(zgemt)(char *, int *, int *, double *, double *, int *, double *, int *);
int BLASFUNC(sgema)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *);
int BLASFUNC(dgema)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *, double *,
int *);
int BLASFUNC(cgema)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *);
int BLASFUNC(zgema)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *, double *,
int *);
void BLASFUNC(sgema)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *);
void BLASFUNC(dgema)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *, double *,
int *);
void BLASFUNC(cgema)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *);
void BLASFUNC(zgema)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *, double *,
int *);
int BLASFUNC(sgems)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *);
int BLASFUNC(dgems)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *, double *,
int *);
int BLASFUNC(cgems)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *);
int BLASFUNC(zgems)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *, double *,
int *);
void BLASFUNC(sgems)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *);
void BLASFUNC(dgems)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *, double *,
int *);
void BLASFUNC(cgems)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, float *, int *);
void BLASFUNC(zgems)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *, double *,
int *);
int BLASFUNC(sgetf2)(int *, int *, float *, int *, int *, int *);
int BLASFUNC(dgetf2)(int *, int *, double *, int *, int *, int *);
int BLASFUNC(qgetf2)(int *, int *, double *, int *, int *, int *);
int BLASFUNC(cgetf2)(int *, int *, float *, int *, int *, int *);
int BLASFUNC(zgetf2)(int *, int *, double *, int *, int *, int *);
int BLASFUNC(xgetf2)(int *, int *, double *, int *, int *, int *);
void BLASFUNC(sgetf2)(int *, int *, float *, int *, int *, int *);
void BLASFUNC(dgetf2)(int *, int *, double *, int *, int *, int *);
void BLASFUNC(qgetf2)(int *, int *, double *, int *, int *, int *);
void BLASFUNC(cgetf2)(int *, int *, float *, int *, int *, int *);
void BLASFUNC(zgetf2)(int *, int *, double *, int *, int *, int *);
void BLASFUNC(xgetf2)(int *, int *, double *, int *, int *, int *);
int BLASFUNC(sgetrf)(int *, int *, float *, int *, int *, int *);
int BLASFUNC(dgetrf)(int *, int *, double *, int *, int *, int *);
int BLASFUNC(qgetrf)(int *, int *, double *, int *, int *, int *);
int BLASFUNC(cgetrf)(int *, int *, float *, int *, int *, int *);
int BLASFUNC(zgetrf)(int *, int *, double *, int *, int *, int *);
int BLASFUNC(xgetrf)(int *, int *, double *, int *, int *, int *);
void BLASFUNC(sgetrf)(int *, int *, float *, int *, int *, int *);
void BLASFUNC(dgetrf)(int *, int *, double *, int *, int *, int *);
void BLASFUNC(qgetrf)(int *, int *, double *, int *, int *, int *);
void BLASFUNC(cgetrf)(int *, int *, float *, int *, int *, int *);
void BLASFUNC(zgetrf)(int *, int *, double *, int *, int *, int *);
void BLASFUNC(xgetrf)(int *, int *, double *, int *, int *, int *);
int BLASFUNC(slaswp)(int *, float *, int *, int *, int *, int *, int *);
int BLASFUNC(dlaswp)(int *, double *, int *, int *, int *, int *, int *);
int BLASFUNC(qlaswp)(int *, double *, int *, int *, int *, int *, int *);
int BLASFUNC(claswp)(int *, float *, int *, int *, int *, int *, int *);
int BLASFUNC(zlaswp)(int *, double *, int *, int *, int *, int *, int *);
int BLASFUNC(xlaswp)(int *, double *, int *, int *, int *, int *, int *);
void BLASFUNC(slaswp)(int *, float *, int *, int *, int *, int *, int *);
void BLASFUNC(dlaswp)(int *, double *, int *, int *, int *, int *, int *);
void BLASFUNC(qlaswp)(int *, double *, int *, int *, int *, int *, int *);
void BLASFUNC(claswp)(int *, float *, int *, int *, int *, int *, int *);
void BLASFUNC(zlaswp)(int *, double *, int *, int *, int *, int *, int *);
void BLASFUNC(xlaswp)(int *, double *, int *, int *, int *, int *, int *);
int BLASFUNC(sgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *);
int BLASFUNC(dgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
int BLASFUNC(qgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
int BLASFUNC(cgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *);
int BLASFUNC(zgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
int BLASFUNC(xgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
void BLASFUNC(sgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *);
void BLASFUNC(dgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
void BLASFUNC(qgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
void BLASFUNC(cgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *);
void BLASFUNC(zgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
void BLASFUNC(xgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *);
int BLASFUNC(sgesv)(int *, int *, float *, int *, int *, float *, int *, int *);
int BLASFUNC(dgesv)(int *, int *, double *, int *, int *, double *, int *, int *);
int BLASFUNC(qgesv)(int *, int *, double *, int *, int *, double *, int *, int *);
int BLASFUNC(cgesv)(int *, int *, float *, int *, int *, float *, int *, int *);
int BLASFUNC(zgesv)(int *, int *, double *, int *, int *, double *, int *, int *);
int BLASFUNC(xgesv)(int *, int *, double *, int *, int *, double *, int *, int *);
void BLASFUNC(sgesv)(int *, int *, float *, int *, int *, float *, int *, int *);
void BLASFUNC(dgesv)(int *, int *, double *, int *, int *, double *, int *, int *);
void BLASFUNC(qgesv)(int *, int *, double *, int *, int *, double *, int *, int *);
void BLASFUNC(cgesv)(int *, int *, float *, int *, int *, float *, int *, int *);
void BLASFUNC(zgesv)(int *, int *, double *, int *, int *, double *, int *, int *);
void BLASFUNC(xgesv)(int *, int *, double *, int *, int *, double *, int *, int *);
int BLASFUNC(spotf2)(char *, int *, float *, int *, int *);
int BLASFUNC(dpotf2)(char *, int *, double *, int *, int *);
int BLASFUNC(qpotf2)(char *, int *, double *, int *, int *);
int BLASFUNC(cpotf2)(char *, int *, float *, int *, int *);
int BLASFUNC(zpotf2)(char *, int *, double *, int *, int *);
int BLASFUNC(xpotf2)(char *, int *, double *, int *, int *);
void BLASFUNC(spotf2)(char *, int *, float *, int *, int *);
void BLASFUNC(dpotf2)(char *, int *, double *, int *, int *);
void BLASFUNC(qpotf2)(char *, int *, double *, int *, int *);
void BLASFUNC(cpotf2)(char *, int *, float *, int *, int *);
void BLASFUNC(zpotf2)(char *, int *, double *, int *, int *);
void BLASFUNC(xpotf2)(char *, int *, double *, int *, int *);
int BLASFUNC(spotrf)(char *, int *, float *, int *, int *);
int BLASFUNC(dpotrf)(char *, int *, double *, int *, int *);
int BLASFUNC(qpotrf)(char *, int *, double *, int *, int *);
int BLASFUNC(cpotrf)(char *, int *, float *, int *, int *);
int BLASFUNC(zpotrf)(char *, int *, double *, int *, int *);
int BLASFUNC(xpotrf)(char *, int *, double *, int *, int *);
void BLASFUNC(spotrf)(char *, int *, float *, int *, int *);
void BLASFUNC(dpotrf)(char *, int *, double *, int *, int *);
void BLASFUNC(qpotrf)(char *, int *, double *, int *, int *);
void BLASFUNC(cpotrf)(char *, int *, float *, int *, int *);
void BLASFUNC(zpotrf)(char *, int *, double *, int *, int *);
void BLASFUNC(xpotrf)(char *, int *, double *, int *, int *);
int BLASFUNC(slauu2)(char *, int *, float *, int *, int *);
int BLASFUNC(dlauu2)(char *, int *, double *, int *, int *);
int BLASFUNC(qlauu2)(char *, int *, double *, int *, int *);
int BLASFUNC(clauu2)(char *, int *, float *, int *, int *);
int BLASFUNC(zlauu2)(char *, int *, double *, int *, int *);
int BLASFUNC(xlauu2)(char *, int *, double *, int *, int *);
void BLASFUNC(slauu2)(char *, int *, float *, int *, int *);
void BLASFUNC(dlauu2)(char *, int *, double *, int *, int *);
void BLASFUNC(qlauu2)(char *, int *, double *, int *, int *);
void BLASFUNC(clauu2)(char *, int *, float *, int *, int *);
void BLASFUNC(zlauu2)(char *, int *, double *, int *, int *);
void BLASFUNC(xlauu2)(char *, int *, double *, int *, int *);
int BLASFUNC(slauum)(char *, int *, float *, int *, int *);
int BLASFUNC(dlauum)(char *, int *, double *, int *, int *);
int BLASFUNC(qlauum)(char *, int *, double *, int *, int *);
int BLASFUNC(clauum)(char *, int *, float *, int *, int *);
int BLASFUNC(zlauum)(char *, int *, double *, int *, int *);
int BLASFUNC(xlauum)(char *, int *, double *, int *, int *);
void BLASFUNC(slauum)(char *, int *, float *, int *, int *);
void BLASFUNC(dlauum)(char *, int *, double *, int *, int *);
void BLASFUNC(qlauum)(char *, int *, double *, int *, int *);
void BLASFUNC(clauum)(char *, int *, float *, int *, int *);
void BLASFUNC(zlauum)(char *, int *, double *, int *, int *);
void BLASFUNC(xlauum)(char *, int *, double *, int *, int *);
int BLASFUNC(strti2)(char *, char *, int *, float *, int *, int *);
int BLASFUNC(dtrti2)(char *, char *, int *, double *, int *, int *);
int BLASFUNC(qtrti2)(char *, char *, int *, double *, int *, int *);
int BLASFUNC(ctrti2)(char *, char *, int *, float *, int *, int *);
int BLASFUNC(ztrti2)(char *, char *, int *, double *, int *, int *);
int BLASFUNC(xtrti2)(char *, char *, int *, double *, int *, int *);
void BLASFUNC(strti2)(char *, char *, int *, float *, int *, int *);
void BLASFUNC(dtrti2)(char *, char *, int *, double *, int *, int *);
void BLASFUNC(qtrti2)(char *, char *, int *, double *, int *, int *);
void BLASFUNC(ctrti2)(char *, char *, int *, float *, int *, int *);
void BLASFUNC(ztrti2)(char *, char *, int *, double *, int *, int *);
void BLASFUNC(xtrti2)(char *, char *, int *, double *, int *, int *);
int BLASFUNC(strtri)(char *, char *, int *, float *, int *, int *);
int BLASFUNC(dtrtri)(char *, char *, int *, double *, int *, int *);
int BLASFUNC(qtrtri)(char *, char *, int *, double *, int *, int *);
int BLASFUNC(ctrtri)(char *, char *, int *, float *, int *, int *);
int BLASFUNC(ztrtri)(char *, char *, int *, double *, int *, int *);
int BLASFUNC(xtrtri)(char *, char *, int *, double *, int *, int *);
void BLASFUNC(strtri)(char *, char *, int *, float *, int *, int *);
void BLASFUNC(dtrtri)(char *, char *, int *, double *, int *, int *);
void BLASFUNC(qtrtri)(char *, char *, int *, double *, int *, int *);
void BLASFUNC(ctrtri)(char *, char *, int *, float *, int *, int *);
void BLASFUNC(ztrtri)(char *, char *, int *, double *, int *, int *);
void BLASFUNC(xtrtri)(char *, char *, int *, double *, int *, int *);
int BLASFUNC(spotri)(char *, int *, float *, int *, int *);
int BLASFUNC(dpotri)(char *, int *, double *, int *, int *);
int BLASFUNC(qpotri)(char *, int *, double *, int *, int *);
int BLASFUNC(cpotri)(char *, int *, float *, int *, int *);
int BLASFUNC(zpotri)(char *, int *, double *, int *, int *);
int BLASFUNC(xpotri)(char *, int *, double *, int *, int *);
void BLASFUNC(spotri)(char *, int *, float *, int *, int *);
void BLASFUNC(dpotri)(char *, int *, double *, int *, int *);
void BLASFUNC(qpotri)(char *, int *, double *, int *, int *);
void BLASFUNC(cpotri)(char *, int *, float *, int *, int *);
void BLASFUNC(zpotri)(char *, int *, double *, int *, int *);
void BLASFUNC(xpotri)(char *, int *, double *, int *, int *);
#ifdef __cplusplus
}

View File

@@ -13,19 +13,8 @@
#include "../blas/common.h"
#include "lapack.h"
#define EIGEN_LAPACK_FUNC(FUNC, ARGLIST) \
extern "C" { \
int EIGEN_BLAS_FUNC(FUNC) ARGLIST; \
} \
int EIGEN_BLAS_FUNC(FUNC) \
ARGLIST
#define EIGEN_LAPACK_FUNC(FUNC) EIGEN_BLAS_FUNC(FUNC)
typedef Eigen::Map<Eigen::Transpositions<Eigen::Dynamic, Eigen::Dynamic, int> > PivotsType;
#if ISCOMPLEX
#define EIGEN_LAPACK_ARG_IF_COMPLEX(X) X,
#else
#define EIGEN_LAPACK_ARG_IF_COMPLEX(X)
#endif
#endif // EIGEN_LAPACK_COMMON_H

View File

@@ -11,7 +11,7 @@
#include <Eigen/LU>
// computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges
EIGEN_LAPACK_FUNC(getrf, (int *m, int *n, RealScalar *pa, int *lda, int *ipiv, int *info)) {
EIGEN_LAPACK_FUNC(getrf)(int *m, int *n, RealScalar *pa, int *lda, int *ipiv, int *info) {
*info = 0;
if (*m < 0)
*info = -1;
@@ -21,28 +21,26 @@ EIGEN_LAPACK_FUNC(getrf, (int *m, int *n, RealScalar *pa, int *lda, int *ipiv, i
*info = -4;
if (*info != 0) {
int e = -*info;
return xerbla_(SCALAR_SUFFIX_UP "GETRF", &e, 6);
return xerbla_(SCALAR_SUFFIX_UP "GETRF", &e);
}
if (*m == 0 || *n == 0) return 0;
if (*m == 0 || *n == 0) return;
Scalar *a = reinterpret_cast<Scalar *>(pa);
int nb_transpositions;
int ret = int(
Eigen::internal::partial_lu_impl<Scalar, ColMajor, int>::blocked_lu(*m, *n, a, *lda, ipiv, nb_transpositions));
int ret = int(Eigen::internal::partial_lu_impl<Scalar, Eigen::ColMajor, int>::blocked_lu(*m, *n, a, *lda, ipiv,
nb_transpositions));
for (int i = 0; i < std::min(*m, *n); ++i) ipiv[i]++;
if (ret >= 0) *info = ret + 1;
return 0;
}
// GETRS solves a system of linear equations
// A * X = B or A' * X = B
// with a general N-by-N matrix A using the LU factorization computed by GETRF
EIGEN_LAPACK_FUNC(getrs, (char *trans, int *n, int *nrhs, RealScalar *pa, int *lda, int *ipiv, RealScalar *pb, int *ldb,
int *info)) {
EIGEN_LAPACK_FUNC(getrs)
(char *trans, int *n, int *nrhs, RealScalar *pa, int *lda, int *ipiv, RealScalar *pb, int *ldb, int *info) {
*info = 0;
if (OP(*trans) == INVALID)
*info = -1;
@@ -56,7 +54,7 @@ EIGEN_LAPACK_FUNC(getrs, (char *trans, int *n, int *nrhs, RealScalar *pa, int *l
*info = -8;
if (*info != 0) {
int e = -*info;
return xerbla_(SCALAR_SUFFIX_UP "GETRS", &e, 6);
return xerbla_(SCALAR_SUFFIX_UP "GETRS", &e);
}
Scalar *a = reinterpret_cast<Scalar *>(pa);
@@ -79,6 +77,4 @@ EIGEN_LAPACK_FUNC(getrs, (char *trans, int *n, int *nrhs, RealScalar *pa, int *l
B = PivotsType(ipiv, *n).transpose() * B;
}
for (int i = 0; i < *n; ++i) ipiv[i]++;
return 0;
}

View File

@@ -10,10 +10,16 @@
#include "lapack_common.h"
#include <Eigen/SVD>
#if ISCOMPLEX
#define EIGEN_LAPACK_ARG_IF_COMPLEX(X) X,
#else
#define EIGEN_LAPACK_ARG_IF_COMPLEX(X)
#endif
// computes the singular values/vectors a general M-by-N matrix A using divide-and-conquer
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 * /*work*/, int *lwork,
EIGEN_LAPACK_ARG_IF_COMPLEX(RealScalar * /*rwork*/) int * /*iwork*/, int *info)) {
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 * /*work*/, int *lwork, EIGEN_LAPACK_ARG_IF_COMPLEX(RealScalar * /*rwork*/) int * /*iwork*/, int *info) {
// TODO exploit the work buffer
bool query_size = *lwork == -1;
int diag_size = (std::min)(*m, *n);
@@ -37,15 +43,15 @@ EIGEN_LAPACK_FUNC(gesdd, (char *jobz, int *m, int *n, Scalar *a, int *lda, RealS
if (*info != 0) {
int e = -*info;
return xerbla_(SCALAR_SUFFIX_UP "GESDD ", &e, 6);
return xerbla_(SCALAR_SUFFIX_UP "GESDD ", &e);
}
if (query_size) {
*lwork = 0;
return 0;
return;
}
if (*n == 0 || *m == 0) return 0;
if (*n == 0 || *m == 0) return;
PlainMatrixType mat(*m, *n);
mat = matrix(a, *m, *n, *lda);
@@ -72,14 +78,12 @@ EIGEN_LAPACK_FUNC(gesdd, (char *jobz, int *m, int *n, Scalar *a, int *lda, RealS
matrix(u, *m, *m, *ldu) = svd.matrixU();
matrix(a, diag_size, *n, *lda) = svd.matrixV().adjoint();
}
return 0;
}
// computes the singular values/vectors a general M-by-N matrix A using two sided jacobi algorithm
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 * /*work*/, int *lwork,
EIGEN_LAPACK_ARG_IF_COMPLEX(RealScalar * /*rwork*/) int *info)) {
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 * /*work*/, int *lwork, EIGEN_LAPACK_ARG_IF_COMPLEX(RealScalar * /*rwork*/) int *info) {
// TODO exploit the work buffer
bool query_size = *lwork == -1;
int diag_size = (std::min)(*m, *n);
@@ -102,15 +106,15 @@ EIGEN_LAPACK_FUNC(gesvd, (char *jobu, char *jobv, int *m, int *n, Scalar *a, int
if (*info != 0) {
int e = -*info;
return xerbla_(SCALAR_SUFFIX_UP "GESVD ", &e, 6);
return xerbla_(SCALAR_SUFFIX_UP "GESVD ", &e);
}
if (query_size) {
*lwork = 0;
return 0;
return;
}
if (*n == 0 || *m == 0) return 0;
if (*n == 0 || *m == 0) return;
PlainMatrixType mat(*m, *n);
mat = matrix(a, *m, *n, *lda);
@@ -141,5 +145,6 @@ EIGEN_LAPACK_FUNC(gesvd, (char *jobu, char *jobv, int *m, int *n, Scalar *a, int
else if (*jobv == 'O')
matrix(a, diag_size, *n, *lda) = svd.matrixV().adjoint();
}
return 0;
}
}
#undef EIGEN_LAPACK_ARG_IF_COMPLEX