From d9c14e815310fcd554018f21146b3dd7f91e12e2 Mon Sep 17 00:00:00 2001 From: Antonio Sanchez Date: Fri, 10 Oct 2025 12:41:31 -0700 Subject: [PATCH] Fix DLL builds and c++ lapack declarations. We need separate `EIGEN_BUILD_*` macros for BLAS/LAPACK for dllexport/dllimport since when building the lapack library, we need to export lapack symbols but import blas symbols. Added ".def" files for Windows builds to ensure fortran symbols are exported in the DLL. There were several LAPACK functions missing from lapack.h that are implemented in Eigen. Added those functions to the `lapack.h` header, and corrected the complex-type scalar inputs for consistency. --- blas/CMakeLists.txt | 5 +- blas/blas.h | 12 +- blas/eigen_blas.def | 222 ++++++++++++++++++++++++ blas/xerbla.cpp | 2 + lapack/CMakeLists.txt | 15 +- lapack/cholesky.inc | 5 +- lapack/dsecnd_INT_CPU_TIME.cpp | 2 + lapack/eigen_lapack.def | 143 +++++++++++++++ lapack/eigen_lapack_cpp.def | 143 +++++++++++++++ lapack/eigenvalues.inc | 6 +- lapack/lapack.h | 307 +++++++++++++++++++-------------- lapack/lu.inc | 2 +- lapack/second_INT_CPU_TIME.cpp | 2 + lapack/svd.inc | 18 +- 14 files changed, 743 insertions(+), 141 deletions(-) create mode 100644 blas/eigen_blas.def create mode 100644 lapack/eigen_lapack.def create mode 100644 lapack/eigen_lapack_cpp.def diff --git a/blas/CMakeLists.txt b/blas/CMakeLists.txt index 27382212d..45488d73d 100644 --- a/blas/CMakeLists.txt +++ b/blas/CMakeLists.txt @@ -19,9 +19,10 @@ add_library(eigen_blas_static STATIC ${EigenBlas_SRCS}) list(APPEND EIGEN_BLAS_TARGETS eigen_blas_static) if (EIGEN_BUILD_SHARED_LIBS) - add_library(eigen_blas SHARED ${EigenBlas_SRCS}) + add_library(eigen_blas SHARED ${EigenBlas_SRCS} "eigen_blas.def") + target_compile_definitions(eigen_blas PUBLIC "EIGEN_BLAS_BUILD_DLL") + set_target_properties(eigen_blas PROPERTIES CXX_VISIBILITY_PRESET hidden) list(APPEND EIGEN_BLAS_TARGETS eigen_blas) - target_compile_definitions(eigen_blas PUBLIC "EIGEN_BUILD_DLL") endif() foreach(target IN LISTS EIGEN_BLAS_TARGETS) diff --git a/blas/blas.h b/blas/blas.h index 2e5e37723..2f218a8b5 100644 --- a/blas/blas.h +++ b/blas/blas.h @@ -2,13 +2,15 @@ #define BLAS_H #if defined(_WIN32) -#if defined(EIGEN_BUILD_DLL) +#if defined(EIGEN_BLAS_BUILD_DLL) #define EIGEN_BLAS_API __declspec(dllexport) -#elif defined(EIGEN_LINK_DLL) +#elif defined(EIGEN_BLAS_LINK_DLL) #define EIGEN_BLAS_API __declspec(dllimport) #else #define EIGEN_BLAS_API #endif +#elif ((defined(__GNUC__) && __GNUC__ >= 4) || defined(__clang__)) && defined(EIGEN_BLAS_BUILD_DLL) +#define EIGEN_BLAS_API __attribute__((visibility("default"))) #else #define EIGEN_BLAS_API #endif @@ -27,6 +29,7 @@ typedef long BLASLONG; typedef unsigned long BLASULONG; #endif +EIGEN_BLAS_API int BLASFUNC(lsame)(const char *, const char *); EIGEN_BLAS_API void BLASFUNC(xerbla)(const char *, int *info); EIGEN_BLAS_API float BLASFUNC(sdot)(int *, float *, int *, float *, int *); @@ -36,6 +39,11 @@ EIGEN_BLAS_API double BLASFUNC(dsdot)(int *, float *, int *, float *, int *); EIGEN_BLAS_API double BLASFUNC(ddot)(int *, double *, int *, double *, int *); EIGEN_BLAS_API double BLASFUNC(qdot)(int *, double *, int *, double *, int *); +EIGEN_BLAS_API void BLASFUNC(cdotu)(int *, float *, int *, float *, int *); +EIGEN_BLAS_API void BLASFUNC(cdotc)(int *, float *, int *, float *, int *); +EIGEN_BLAS_API void BLASFUNC(zdotu)(int *, double *, int *, double *, int *); +EIGEN_BLAS_API void BLASFUNC(zdotc)(int *, double *, int *, double *, int *); + EIGEN_BLAS_API void BLASFUNC(cdotuw)(int *, float *, int *, float *, int *, float *); EIGEN_BLAS_API void BLASFUNC(cdotcw)(int *, float *, int *, float *, int *, float *); EIGEN_BLAS_API void BLASFUNC(zdotuw)(int *, double *, int *, double *, int *, double *); diff --git a/blas/eigen_blas.def b/blas/eigen_blas.def new file mode 100644 index 000000000..fb18d44a0 --- /dev/null +++ b/blas/eigen_blas.def @@ -0,0 +1,222 @@ +; Definition file for eigen_blas.dll. + +LIBRARY eigen_blas +EXPORTS + ; Utilities + lsame_ + xerbla_ + + ; Level 1 + saxpy_ + daxpy_ + caxpy_ + zaxpy_ + ; caxpyc_ + ; zaxpyc_ + scopy_ + dcopy_ + ccopy_ + zcopy_ + sdot_ + sdsdot_ + dsdot_ + ddot_ + cdotc_ + zdotc_ + cdotu_ + zdotu_ + cdotcw_ + zdotcw_ + cdotuw_ + zdotuw_ + snrm2_ + dnrm2_ + scnrm2_ + dznrm2_ + srot_ + drot_ + csrot_ + zdrot_ + srotg_ + drotg_ + crotg_ + zrotg_ + srotm_ + drotm_ + srotmg_ + drotmg_ + sscal_ + dscal_ + cscal_ + zscal_ + csscal_ + zdscal_ + sswap_ + dswap_ + cswap_ + zswap_ + sasum_ + scasum_ + dasum_ + dzasum_ + ; ismax_ + ; idmax_ + ; icmax_ + ; izmax_ + isamax_ + idamax_ + icamax_ + izamax_ + isamin_ + idamin_ + icamin_ + izamin_ + ; ismin_ + ; idmin_ + ; icmin_ + ; izmin_ + ; samax_ + ; damax_ + ; scamax_ + ; dzamax_ + ; samin_ + ; damin_ + ; scamin_ + ; dzamin_ + ; smax_ + ; dmax_ + ; cmax_ + ; zmax_ + ; smin_ + ; dmin_ + ; cmin_ + ; zmin_ + + + ; Level 2 + sgemv_ + dgemv_ + cgemv_ + zgemv_ + sger_ + dger_ + cgerc_ + zgerc_ + cgeru_ + zgeru_ + ssymv_ + dsymv_ + ssyr_ + dsyr_ + ssyr2_ + dsyr2_ + ; csyr2_ + ; zsyr2_ + strmv_ + dtrmv_ + ctrmv_ + ztrmv_ + strsv_ + dtrsv_ + ctrsv_ + ztrsv_ + stpsv_ + dtpsv_ + ctpsv_ + ztpsv_ + stpmv_ + dtpmv_ + ctpmv_ + ztpmv_ + stbmv_ + dtbmv_ + ctbmv_ + ztbmv_ + stbsv_ + dtbsv_ + ctbsv_ + ztbsv_ + sspmv_ + dspmv_ + sspr_ + dspr_ + ; cspr_ + ; zspr_ + sspr2_ + dspr2_ + ; cspr2_ + ; zspr2_ + cher_ + zher_ + chpr_ + zhpr_ + cher2_ + zher2_ + chpr2_ + zhpr2_ + chemv_ + zhemv_ + chpmv_ + zhpmv_ + ; snorm_ + ; dnorm_ + ; cnorm_ + ; znorm_ + sgbmv_ + dgbmv_ + cgbmv_ + zgbmv_ + ssbmv_ + dsbmv_ + ; csbmv_ + ; zsbmv_ + chbmv_ + zhbmv_ + + ; Level 3 BLAS + sgemm_ + dgemm_ + cgemm_ + zgemm_ + ; cgemm3m_ + ; zgemm3m_ + ; sge2mm_ + ; dge2mm_ + ; cge2mm_ + ; zge2mm_ + ssymm_ + dsymm_ + csymm_ + zsymm_ + ; csymm3m_ + ; zsymm3m_ + ssyrk_ + dsyrk_ + csyrk_ + zsyrk_ + ssyr2k_ + dsyr2k_ + csyr2k_ + zsyr2k_ + strmm_ + dtrmm_ + ctrmm_ + ztrmm_ + strsm_ + dtrsm_ + ctrsm_ + ztrsm_ + chemm_ + zhemm_ + ; chemm3m_ + ; zhemm3m_ + cherk_ + zherk_ + cher2k_ + zher2k_ + ; cher2m_ + ; zher2m_ + sgemmtr_ + dgemmtr_ + cgemmtr_ + zgemmtr_ diff --git a/blas/xerbla.cpp b/blas/xerbla.cpp index 0b59c4a35..94c8c1d99 100644 --- a/blas/xerbla.cpp +++ b/blas/xerbla.cpp @@ -1,6 +1,8 @@ #include +#include "blas.h" + #if (defined __GNUC__) && (!defined __MINGW32__) && (!defined __CYGWIN__) #define EIGEN_WEAK_LINKING __attribute__((weak)) #else diff --git a/lapack/CMakeLists.txt b/lapack/CMakeLists.txt index bede443db..d837fff96 100644 --- a/lapack/CMakeLists.txt +++ b/lapack/CMakeLists.txt @@ -22,9 +22,11 @@ add_custom_target(lapack) include_directories(../blas) set(EigenLapack_SRCS - dsecnd_INT_CPU_TIME.cpp second_INT_CPU_TIME.cpp single.cpp double.cpp complex_single.cpp complex_double.cpp ../blas/xerbla.cpp + dsecnd_INT_CPU_TIME.cpp second_INT_CPU_TIME.cpp single.cpp double.cpp complex_single.cpp complex_double.cpp ) +set(EIGEN_LAPACK_DEF "eigen_lapack_cpp.def") + if(EIGEN_Fortran_COMPILER_WORKS) set(EigenLapack_SRCS ${EigenLapack_SRCS} @@ -40,6 +42,8 @@ set(EigenLapack_SRCS ${EigenLapack_SRCS} slamch.f dlamch.f ) +set(EIGEN_LAPACK_DEF "eigen_lapack.def") + option(EIGEN_ENABLE_LAPACK_TESTS OFF "Enable the Lapack unit tests") if(EIGEN_ENABLE_LAPACK_TESTS) @@ -98,13 +102,16 @@ endif() set(EIGEN_LAPACK_TARGETS "") add_library(eigen_lapack_static STATIC ${EigenLapack_SRCS} ${ReferenceLapack_SRCS}) +target_link_libraries(eigen_lapack_static eigen_blas_static) list(APPEND EIGEN_LAPACK_TARGETS eigen_lapack_static) if (EIGEN_BUILD_SHARED_LIBS) - add_library(eigen_lapack SHARED ${EigenLapack_SRCS}) - target_compile_definitions(eigen_lapack PUBLIC "EIGEN_BUILD_DLL") - list(APPEND EIGEN_LAPACK_TARGETS eigen_lapack) + add_library(eigen_lapack SHARED ${EigenLapack_SRCS} ${EIGEN_LAPACK_DEF}) + # Build LAPACK but link BLAS. + target_compile_definitions(eigen_lapack PUBLIC "EIGEN_BLAS_LINK_DLL" "EIGEN_LAPACK_BUILD_DLL") target_link_libraries(eigen_lapack eigen_blas) + set_target_properties(eigen_lapack PROPERTIES CXX_VISIBILITY_PRESET hidden) + list(APPEND EIGEN_LAPACK_TARGETS eigen_lapack) endif() foreach(target IN LISTS EIGEN_LAPACK_TARGETS) diff --git a/lapack/cholesky.inc b/lapack/cholesky.inc index a93a51152..695d3b847 100644 --- a/lapack/cholesky.inc +++ b/lapack/cholesky.inc @@ -11,7 +11,7 @@ #include // 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)(const char *uplo, int *n, RealScalar *pa, int *lda, int *info) { *info = 0; if (UPLO(*uplo) == INVALID) *info = -1; @@ -38,7 +38,8 @@ EIGEN_LAPACK_FUNC(potrf)(char *uplo, int *n, RealScalar *pa, int *lda, int *info // 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) +(const char *uplo, int *n, int *nrhs, RealScalar *pa, int *lda, RealScalar *pb, int *ldb, int *info) { *info = 0; if (UPLO(*uplo) == INVALID) *info = -1; diff --git a/lapack/dsecnd_INT_CPU_TIME.cpp b/lapack/dsecnd_INT_CPU_TIME.cpp index 684fa1d78..7dfc5e288 100644 --- a/lapack/dsecnd_INT_CPU_TIME.cpp +++ b/lapack/dsecnd_INT_CPU_TIME.cpp @@ -15,6 +15,8 @@ #include #endif +#include "lapack.h" + extern "C" { double dsecnd_(); } diff --git a/lapack/eigen_lapack.def b/lapack/eigen_lapack.def new file mode 100644 index 000000000..4e882cd84 --- /dev/null +++ b/lapack/eigen_lapack.def @@ -0,0 +1,143 @@ +; Definition file for eigen_lapack.dll. + +LIBRARY eigen_lapack +EXPORTS + ; Eigen C/C++ implementations + ; Utilities + xerbla_ + + ; Eigenvalues + ssyev_ + dsyev_ + + ; LU + sgetrf_ + sgetrs_ + dgetrf_ + dgetrs_ + cgetrf_ + cgetrs_ + zgetrf_ + zgetrs_ + + ; QR + spotrf_ + spotrs_ + dpotrf_ + dpotrs_ + cpotrf_ + cpotrs_ + zpotrf_ + zpotrs_ + + ; SVD + sgesdd_ + sgesvd_ + dgesdd_ + dgesvd_ + cgesdd_ + cgesvd_ + zgesdd_ + zgesvd_ + + ; Time + second_ + dsecnd_ + + ; Fortran implementations + clacgv_ + zlacgv_ + sladiv_ + dladiv_ + cladiv_ + zladiv_ + slamch_ + dlamch_ + slamc3_ + dlamc3_ + slapy2_ + dlapy2_ + slapy3_ + dlapy3_ + slarf_ + dlarf_ + clarf_ + zlarf_ + slarfb_ + dlarfb_ + clarfb_ + zlarfb_ + slarfg_ + dlarfg_ + clarfg_ + zlarfg_ + slarft_ + dlarft_ + clarft_ + zlarft_ + ilaclc_ + ilaclr_ + iladlc_ + iladlr_ + ilaslc_ + ilaslr_ + ilazlc_ + ilazlr_ + + ; Missing + ; csymv_ + ; zsymv_ + ; cspmv_ + ; zspmv_ + ; csyr_ + ; zsyr_ + ; cspr_ + ; zspr_ + ; sgemt_ + ; dgemt_ + ; cgemt_ + ; zgemt_ + ; sgema_ + ; dgema_ + ; cgema_ + ; zgema_ + ; sgems_ + ; dgems_ + ; cgems_ + ; zgems_ + ; sgetf2_ + ; dgetf2_ + ; cgetf2_ + ; zgetf2_ + ; slaswp_ + ; dlaswp_ + ; claswp_ + ; zlaswp_ + ; sgesv_ + ; dgesv_ + ; cgesv_ + ; zgesv_ + ; spotf2_ + ; dpotf2_ + ; cpotf2_ + ; zpotf2_ + ; slauu2_ + ; dlauu2_ + ; clauu2_ + ; zlauu2_ + ; slauum_ + ; dlauum_ + ; clauum_ + ; zlauum_ + ; strti2_ + ; dtrti2_ + ; ctrti2_ + ; ztrti2_ + ; strtri_ + ; dtrtri_ + ; ctrtri_ + ; ztrtri_ + ; spotri_ + ; dpotri_ + ; cpotri_ + ; zpotri_ diff --git a/lapack/eigen_lapack_cpp.def b/lapack/eigen_lapack_cpp.def new file mode 100644 index 000000000..4df600b64 --- /dev/null +++ b/lapack/eigen_lapack_cpp.def @@ -0,0 +1,143 @@ +; Definition file for eigen_lapack.dll, containing only the C++ implementations. + +LIBRARY eigen_lapack +EXPORTS + ; Eigen C/C++ implementations + ; Utilities + xerbla_ + + ; Eigenvalues + ssyev_ + dsyev_ + + ; LU + sgetrf_ + sgetrs_ + dgetrf_ + dgetrs_ + cgetrf_ + cgetrs_ + zgetrf_ + zgetrs_ + + ; QR + spotrf_ + spotrs_ + dpotrf_ + dpotrs_ + cpotrf_ + cpotrs_ + zpotrf_ + zpotrs_ + + ; SVD + sgesdd_ + sgesvd_ + dgesdd_ + dgesvd_ + cgesdd_ + cgesvd_ + zgesdd_ + zgesvd_ + + ; Time + second_ + dsecnd_ + + ; Fortran implementations + ; clacgv_ + ; zlacgv_ + ; sladiv_ + ; dladiv_ + ; cladiv_ + ; zladiv_ + ; slamch_ + ; dlamch_ + ; slamc3_ + ; dlamc3_ + ; slapy2_ + ; dlapy2_ + ; slapy3_ + ; dlapy3_ + ; slarf_ + ; dlarf_ + ; clarf_ + ; zlarf_ + ; slarfb_ + ; dlarfb_ + ; clarfb_ + ; zlarfb_ + ; slarfg_ + ; dlarfg_ + ; clarfg_ + ; zlarfg_ + ; slarft_ + ; dlarft_ + ; clarft_ + ; zlarft_ + ; ilaclc_ + ; ilaclr_ + ; iladlc_ + ; iladlr_ + ; ilaslc_ + ; ilaslr_ + ; ilazlc_ + ; ilazlr_ + + ; Missing + ; csymv_ + ; zsymv_ + ; cspmv_ + ; zspmv_ + ; csyr_ + ; zsyr_ + ; cspr_ + ; zspr_ + ; sgemt_ + ; dgemt_ + ; cgemt_ + ; zgemt_ + ; sgema_ + ; dgema_ + ; cgema_ + ; zgema_ + ; sgems_ + ; dgems_ + ; cgems_ + ; zgems_ + ; sgetf2_ + ; dgetf2_ + ; cgetf2_ + ; zgetf2_ + ; slaswp_ + ; dlaswp_ + ; claswp_ + ; zlaswp_ + ; sgesv_ + ; dgesv_ + ; cgesv_ + ; zgesv_ + ; spotf2_ + ; dpotf2_ + ; cpotf2_ + ; zpotf2_ + ; slauu2_ + ; dlauu2_ + ; clauu2_ + ; zlauu2_ + ; slauum_ + ; dlauum_ + ; clauum_ + ; zlauum_ + ; strti2_ + ; dtrti2_ + ; ctrti2_ + ; ztrti2_ + ; strtri_ + ; dtrtri_ + ; ctrtri_ + ; ztrtri_ + ; spotri_ + ; dpotri_ + ; cpotri_ + ; zpotri_ diff --git a/lapack/eigenvalues.inc b/lapack/eigenvalues.inc index 211a7ff4e..c67c82562 100644 --- a/lapack/eigenvalues.inc +++ b/lapack/eigenvalues.inc @@ -12,7 +12,8 @@ // 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) { +(const char* jobz, const char* uplo, int* n, RealScalar* ra, int* lda, RealScalar* rw, RealScalar* /*work*/, int* lwork, + int* info) { // TODO exploit the work buffer bool query_size = *lwork == -1; @@ -40,6 +41,9 @@ EIGEN_LAPACK_FUNC(syev) if (*n == 0) return; + Scalar* a = reinterpret_cast(ra); + Scalar* w = reinterpret_cast(rw); + PlainMatrixType mat(*n, *n); if (UPLO(*uplo) == UP) mat = matrix(a, *n, *n, *lda).adjoint(); diff --git a/lapack/lapack.h b/lapack/lapack.h index 49443eb75..ad6485db6 100644 --- a/lapack/lapack.h +++ b/lapack/lapack.h @@ -3,135 +3,192 @@ #include "../blas/blas.h" +#if defined(_WIN32) +#if defined(EIGEN_LAPACK_BUILD_DLL) +#define EIGEN_LAPACK_API __declspec(dllexport) +#elif defined(EIGEN_LAPACK_LINK_DLL) +#define EIGEN_LAPACK_API __declspec(dllimport) +#else +#define EIGEN_LAPACK_API +#endif +#elif ((defined(__GNUC__) && __GNUC__ >= 4) || defined(__clang__)) && defined(EIGEN_LAPACK_BUILD_DLL) +#define EIGEN_LAPACK_API __attribute__((visibility("default"))) +#else +#define EIGEN_LAPACK_API +#endif + #ifdef __cplusplus extern "C" { #endif -EIGEN_BLAS_API void BLASFUNC(csymv)(const char *, const int *, const float *, const float *, const int *, const float *, - const int *, const float *, float *, const int *); -EIGEN_BLAS_API void BLASFUNC(zsymv)(const char *, const int *, const double *, const double *, const int *, - const double *, const int *, const double *, double *, const int *); -EIGEN_BLAS_API void BLASFUNC(xsymv)(const char *, const int *, const double *, const double *, const int *, - const double *, const int *, const double *, double *, const int *); - -EIGEN_BLAS_API void BLASFUNC(cspmv)(char *, int *, float *, float *, float *, int *, float *, float *, int *); -EIGEN_BLAS_API void BLASFUNC(zspmv)(char *, int *, double *, double *, double *, int *, double *, double *, int *); -EIGEN_BLAS_API void BLASFUNC(xspmv)(char *, int *, double *, double *, double *, int *, double *, double *, int *); - -EIGEN_BLAS_API void BLASFUNC(csyr)(char *, int *, float *, float *, int *, float *, int *); -EIGEN_BLAS_API void BLASFUNC(zsyr)(char *, int *, double *, double *, int *, double *, int *); -EIGEN_BLAS_API void BLASFUNC(xsyr)(char *, int *, double *, double *, int *, double *, int *); - -EIGEN_BLAS_API void BLASFUNC(cspr)(char *, int *, float *, float *, int *, float *); -EIGEN_BLAS_API void BLASFUNC(zspr)(char *, int *, double *, double *, int *, double *); -EIGEN_BLAS_API void BLASFUNC(xspr)(char *, int *, double *, double *, int *, double *); - -EIGEN_BLAS_API void BLASFUNC(sgemt)(char *, int *, int *, float *, float *, int *, float *, int *); -EIGEN_BLAS_API void BLASFUNC(dgemt)(char *, int *, int *, double *, double *, int *, double *, int *); -EIGEN_BLAS_API void BLASFUNC(cgemt)(char *, int *, int *, float *, float *, int *, float *, int *); -EIGEN_BLAS_API void BLASFUNC(zgemt)(char *, int *, int *, double *, double *, int *, double *, int *); - -EIGEN_BLAS_API void BLASFUNC(sgema)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, - float *, int *); -EIGEN_BLAS_API void BLASFUNC(dgema)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *, - double *, int *); -EIGEN_BLAS_API void BLASFUNC(cgema)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, - float *, int *); -EIGEN_BLAS_API void BLASFUNC(zgema)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *, - double *, int *); - -EIGEN_BLAS_API void BLASFUNC(sgems)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, - float *, int *); -EIGEN_BLAS_API void BLASFUNC(dgems)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *, - double *, int *); -EIGEN_BLAS_API void BLASFUNC(cgems)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, - float *, int *); -EIGEN_BLAS_API void BLASFUNC(zgems)(char *, char *, int *, int *, double *, double *, int *, double *, double *, int *, - double *, int *); - -EIGEN_BLAS_API void BLASFUNC(sgetf2)(int *, int *, float *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(dgetf2)(int *, int *, double *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(qgetf2)(int *, int *, double *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(cgetf2)(int *, int *, float *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(zgetf2)(int *, int *, double *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(xgetf2)(int *, int *, double *, int *, int *, int *); - -EIGEN_BLAS_API void BLASFUNC(sgetrf)(int *, int *, float *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(dgetrf)(int *, int *, double *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(qgetrf)(int *, int *, double *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(cgetrf)(int *, int *, float *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(zgetrf)(int *, int *, double *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(xgetrf)(int *, int *, double *, int *, int *, int *); - -EIGEN_BLAS_API void BLASFUNC(slaswp)(int *, float *, int *, int *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(dlaswp)(int *, double *, int *, int *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(qlaswp)(int *, double *, int *, int *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(claswp)(int *, float *, int *, int *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(zlaswp)(int *, double *, int *, int *, int *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(xlaswp)(int *, double *, int *, int *, int *, int *, int *); - -EIGEN_BLAS_API void BLASFUNC(sgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(dgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(qgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(cgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(zgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(xgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); - -EIGEN_BLAS_API void BLASFUNC(sgesv)(int *, int *, float *, int *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(dgesv)(int *, int *, double *, int *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(qgesv)(int *, int *, double *, int *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(cgesv)(int *, int *, float *, int *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(zgesv)(int *, int *, double *, int *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(xgesv)(int *, int *, double *, int *, int *, double *, int *, int *); - -EIGEN_BLAS_API void BLASFUNC(spotf2)(char *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(dpotf2)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(qpotf2)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(cpotf2)(char *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(zpotf2)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(xpotf2)(char *, int *, double *, int *, int *); - -EIGEN_BLAS_API void BLASFUNC(spotrf)(char *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(dpotrf)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(qpotrf)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(cpotrf)(char *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(zpotrf)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(xpotrf)(char *, int *, double *, int *, int *); - -EIGEN_BLAS_API void BLASFUNC(slauu2)(char *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(dlauu2)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(qlauu2)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(clauu2)(char *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(zlauu2)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(xlauu2)(char *, int *, double *, int *, int *); - -EIGEN_BLAS_API void BLASFUNC(slauum)(char *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(dlauum)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(qlauum)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(clauum)(char *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(zlauum)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(xlauum)(char *, int *, double *, int *, int *); - -EIGEN_BLAS_API void BLASFUNC(strti2)(char *, char *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(dtrti2)(char *, char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(qtrti2)(char *, char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(ctrti2)(char *, char *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(ztrti2)(char *, char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(xtrti2)(char *, char *, int *, double *, int *, int *); - -EIGEN_BLAS_API void BLASFUNC(strtri)(char *, char *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(dtrtri)(char *, char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(qtrtri)(char *, char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(ctrtri)(char *, char *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(ztrtri)(char *, char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(xtrtri)(char *, char *, int *, double *, int *, int *); - -EIGEN_BLAS_API void BLASFUNC(spotri)(char *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(dpotri)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(qpotri)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(cpotri)(char *, int *, float *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(zpotri)(char *, int *, double *, int *, int *); -EIGEN_BLAS_API void BLASFUNC(xpotri)(char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(csymv)(const char *, const int *, const float *, const float *, const int *, + const float *, const int *, const float *, float *, const int *); +EIGEN_LAPACK_API void BLASFUNC(zsymv)(const char *, const int *, const double *, const double *, const int *, + const double *, const int *, const double *, double *, const int *); +EIGEN_LAPACK_API void BLASFUNC(xsymv)(const char *, const int *, const double *, const double *, const int *, + const double *, const int *, const double *, double *, const int *); + +EIGEN_LAPACK_API void BLASFUNC(cspmv)(char *, int *, float *, float *, float *, int *, float *, float *, int *); +EIGEN_LAPACK_API void BLASFUNC(zspmv)(char *, int *, double *, double *, double *, int *, double *, double *, int *); +EIGEN_LAPACK_API void BLASFUNC(xspmv)(char *, int *, double *, double *, double *, int *, double *, double *, int *); + +EIGEN_LAPACK_API void BLASFUNC(csyr)(char *, int *, float *, float *, int *, float *, int *); +EIGEN_LAPACK_API void BLASFUNC(zsyr)(char *, int *, double *, double *, int *, double *, int *); +EIGEN_LAPACK_API void BLASFUNC(xsyr)(char *, int *, double *, double *, int *, double *, int *); + +EIGEN_LAPACK_API void BLASFUNC(cspr)(char *, int *, float *, float *, int *, float *); +EIGEN_LAPACK_API void BLASFUNC(zspr)(char *, int *, double *, double *, int *, double *); +EIGEN_LAPACK_API void BLASFUNC(xspr)(char *, int *, double *, double *, int *, double *); + +EIGEN_LAPACK_API void BLASFUNC(sgemt)(char *, int *, int *, float *, float *, int *, float *, int *); +EIGEN_LAPACK_API void BLASFUNC(dgemt)(char *, int *, int *, double *, double *, int *, double *, int *); +EIGEN_LAPACK_API void BLASFUNC(cgemt)(char *, int *, int *, float *, float *, int *, float *, int *); +EIGEN_LAPACK_API void BLASFUNC(zgemt)(char *, int *, int *, double *, double *, int *, double *, int *); + +EIGEN_LAPACK_API void BLASFUNC(sgema)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, + float *, int *); +EIGEN_LAPACK_API void BLASFUNC(dgema)(char *, char *, int *, int *, double *, double *, int *, double *, double *, + int *, double *, int *); +EIGEN_LAPACK_API void BLASFUNC(cgema)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, + float *, int *); +EIGEN_LAPACK_API void BLASFUNC(zgema)(char *, char *, int *, int *, double *, double *, int *, double *, double *, + int *, double *, int *); + +EIGEN_LAPACK_API void BLASFUNC(sgems)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, + float *, int *); +EIGEN_LAPACK_API void BLASFUNC(dgems)(char *, char *, int *, int *, double *, double *, int *, double *, double *, + int *, double *, int *); +EIGEN_LAPACK_API void BLASFUNC(cgems)(char *, char *, int *, int *, float *, float *, int *, float *, float *, int *, + float *, int *); +EIGEN_LAPACK_API void BLASFUNC(zgems)(char *, char *, int *, int *, double *, double *, int *, double *, double *, + int *, double *, int *); + +EIGEN_LAPACK_API void BLASFUNC(sgetf2)(int *, int *, float *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dgetf2)(int *, int *, double *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(qgetf2)(int *, int *, double *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(cgetf2)(int *, int *, float *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(zgetf2)(int *, int *, double *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(xgetf2)(int *, int *, double *, int *, int *, int *); + +EIGEN_LAPACK_API void BLASFUNC(qgetrf)(int *, int *, double *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(xgetrf)(int *, int *, double *, int *, int *, int *); + +EIGEN_LAPACK_API void BLASFUNC(slaswp)(int *, float *, int *, int *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dlaswp)(int *, double *, int *, int *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(qlaswp)(int *, double *, int *, int *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(claswp)(int *, float *, int *, int *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(zlaswp)(int *, double *, int *, int *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(xlaswp)(int *, double *, int *, int *, int *, int *, int *); + +EIGEN_LAPACK_API void BLASFUNC(qgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(xgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); + +EIGEN_LAPACK_API void BLASFUNC(sgesv)(int *, int *, float *, int *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dgesv)(int *, int *, double *, int *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(qgesv)(int *, int *, double *, int *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(cgesv)(int *, int *, float *, int *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(zgesv)(int *, int *, double *, int *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(xgesv)(int *, int *, double *, int *, int *, double *, int *, int *); + +EIGEN_LAPACK_API void BLASFUNC(spotf2)(char *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dpotf2)(char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(qpotf2)(char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(cpotf2)(char *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(zpotf2)(char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(xpotf2)(char *, int *, double *, int *, int *); + +EIGEN_LAPACK_API void BLASFUNC(qpotrf)(char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(xpotrf)(char *, int *, double *, int *, int *); + +EIGEN_LAPACK_API void BLASFUNC(slauu2)(char *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dlauu2)(char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(qlauu2)(char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(clauu2)(char *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(zlauu2)(char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(xlauu2)(char *, int *, double *, int *, int *); + +EIGEN_LAPACK_API void BLASFUNC(slauum)(char *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dlauum)(char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(qlauum)(char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(clauum)(char *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(zlauum)(char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(xlauum)(char *, int *, double *, int *, int *); + +EIGEN_LAPACK_API void BLASFUNC(strti2)(char *, char *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dtrti2)(char *, char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(qtrti2)(char *, char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(ctrti2)(char *, char *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(ztrti2)(char *, char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(xtrti2)(char *, char *, int *, double *, int *, int *); + +EIGEN_LAPACK_API void BLASFUNC(strtri)(char *, char *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dtrtri)(char *, char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(qtrtri)(char *, char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(ctrtri)(char *, char *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(ztrtri)(char *, char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(xtrtri)(char *, char *, int *, double *, int *, int *); + +EIGEN_LAPACK_API void BLASFUNC(spotri)(char *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dpotri)(char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(qpotri)(char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(cpotri)(char *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(zpotri)(char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(xpotri)(char *, int *, double *, int *, int *); + +//----------------------------------------------------------------------------- +// Eigen C++ implementations. +//----------------------------------------------------------------------------- + +// Cholesky. +EIGEN_LAPACK_API void BLASFUNC(spotrf)(const char *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dpotrf)(const char *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(cpotrf)(const char *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(zpotrf)(const char *, int *, double *, int *, int *); + +EIGEN_LAPACK_API void BLASFUNC(spotrs)(const char *, int *, int *, float *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dpotrs)(const char *, int *, int *, double *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(cpotrs)(const char *, int *, int *, float *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(zpotrs)(const char *, int *, int *, double *, int *, double *, int *, int *); + +// Eigenvalues. +EIGEN_LAPACK_API void BLASFUNC(ssyev)(const char *, const char *, int *, float *, int *, float *, float *, int *, + int *); +EIGEN_LAPACK_API void BLASFUNC(dsyev)(const char *, const char *, int *, double *, int *, double *, double *, int *, + int *); + +// LU. +EIGEN_LAPACK_API void BLASFUNC(sgetrf)(int *, int *, float *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dgetrf)(int *, int *, double *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(cgetrf)(int *, int *, float *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(zgetrf)(int *, int *, double *, int *, int *, int *); + +EIGEN_LAPACK_API void BLASFUNC(sgetrs)(const char *, int *, int *, float *, int *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dgetrs)(const char *, int *, int *, double *, int *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(cgetrs)(const char *, int *, int *, float *, int *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(zgetrs)(const char *, int *, int *, double *, int *, int *, double *, int *, int *); + +// SVD. +EIGEN_LAPACK_API void BLASFUNC(sgesdd)(const char *, int *, int *, float *, int *, float *, float *, int *, float *, + int *, float *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dgesdd)(const char *, int *, int *, double *, int *, double *, double *, int *, double *, + int *, double *, int *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(cgesdd)(const char *, int *, int *, float *, int *, float *, float *, int *, float *, + int *, float *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(zgesdd)(const char *, int *, int *, double *, int *, double *, double *, int *, double *, + int *, double *, int *, double *, int *, int *); + +EIGEN_LAPACK_API void BLASFUNC(sgesvd)(const char *, const char *, int *, int *, float *, int *, float *, float *, + int *, float *, int *, float *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(dgesvd)(const char *, const char *, int *, int *, double *, int *, double *, double *, + int *, double *, int *, double *, int *, int *); +EIGEN_LAPACK_API void BLASFUNC(cgesvd)(const char *, const char *, int *, int *, float *, int *, float *, float *, + int *, float *, int *, float *, int *, float *, int *); +EIGEN_LAPACK_API void BLASFUNC(zgesvd)(const char *, const char *, int *, int *, double *, int *, double *, double *, + int *, double *, int *, double *, int *, double *, int *); + +// Time. +EIGEN_LAPACK_API float BLASFUNC(second)(); +EIGEN_LAPACK_API double BLASFUNC(dsecnd)(); #ifdef __cplusplus } diff --git a/lapack/lu.inc b/lapack/lu.inc index 2ddaf957a..69fdc3ded 100644 --- a/lapack/lu.inc +++ b/lapack/lu.inc @@ -40,7 +40,7 @@ EIGEN_LAPACK_FUNC(getrf)(int *m, int *n, RealScalar *pa, int *lda, int *ipiv, in // 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) { +(const 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; diff --git a/lapack/second_INT_CPU_TIME.cpp b/lapack/second_INT_CPU_TIME.cpp index d6eb4029b..49371ffe4 100644 --- a/lapack/second_INT_CPU_TIME.cpp +++ b/lapack/second_INT_CPU_TIME.cpp @@ -15,6 +15,8 @@ #include #endif +#include "lapack.h" + extern "C" { float second_(); } diff --git a/lapack/svd.inc b/lapack/svd.inc index 795cfb45e..733f07ef5 100644 --- a/lapack/svd.inc +++ b/lapack/svd.inc @@ -18,8 +18,9 @@ // 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) { +(const char *jobz, int *m, int *n, RealScalar *ra, int *lda, RealScalar *s, RealScalar *ru, int *ldu, RealScalar *rvt, + int *ldvt, RealScalar * /*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); @@ -53,6 +54,10 @@ EIGEN_LAPACK_FUNC(gesdd) if (*n == 0 || *m == 0) return; + Scalar *a = reinterpret_cast(ra); + Scalar *u = reinterpret_cast(ru); + Scalar *vt = reinterpret_cast(rvt); + PlainMatrixType mat(*m, *n); mat = matrix(a, *m, *n, *lda); @@ -84,8 +89,9 @@ EIGEN_LAPACK_FUNC(gesdd) // 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) { +(const char *jobu, const char *jobv, int *m, int *n, RealScalar *ra, int *lda, RealScalar *s, RealScalar *ru, int *ldu, + RealScalar *rvt, int *ldvt, RealScalar * /*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); @@ -118,6 +124,10 @@ EIGEN_LAPACK_FUNC(gesvd) if (*n == 0 || *m == 0) return; + Scalar *a = reinterpret_cast(ra); + Scalar *u = reinterpret_cast(ru); + Scalar *vt = reinterpret_cast(rvt); + PlainMatrixType mat(*m, *n); mat = matrix(a, *m, *n, *lda); -- GitLab