From 8c82a8294483ffac4d8e9635376723f26a8ae27b Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Fri, 22 May 2020 07:15:37 -0500 Subject: Fixes for gcc (GCC) 10.1.0 Started to remove eigenlib (again) --- src/fastblas.cpp | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'src/fastblas.cpp') diff --git a/src/fastblas.cpp b/src/fastblas.cpp index b3fcddb..e9e38d0 100644 --- a/src/fastblas.cpp +++ b/src/fastblas.cpp @@ -18,7 +18,7 @@ along with this program. If not, see . */ -#include "gsl/gsl_matrix.h" +// #include "gsl/gsl_matrix.h" #include // std::min #include #include @@ -235,8 +235,39 @@ void fast_dgemm(const char *TransA, const char *TransB, const double alpha, void fast_eigen_dgemm(const char *TransA, const char *TransB, const double alpha, const gsl_matrix *A, const gsl_matrix *B, const double beta, gsl_matrix *C) { - if (is_legacy_mode()) - eigenlib_dgemm(TransA,TransB,alpha,A,B,beta,C); - else fast_cblas_dgemm(TransA,TransB,alpha,A,B,beta,C); } + +/* + * Inverse in place + */ + +#include +#include + +void gsl_matrix_inv(gsl_matrix *m) +{ + size_t n=m->size1; + + gsl_matrix *temp1=gsl_matrix_calloc(n,n); + gsl_matrix_memcpy(temp1,m); + + gsl_permutation *p=gsl_permutation_calloc(n); + int sign=0; + gsl_linalg_LU_decomp(temp1,p,&sign); + gsl_matrix *inverse=gsl_matrix_calloc(n,n); + + gsl_linalg_LU_invert(temp1,p,inverse); + gsl_matrix_memcpy(m,inverse); + + gsl_permutation_free(p); + gsl_matrix_free(temp1); + gsl_matrix_free(inverse); + +} + +void fast_inverse(gsl_matrix *m) { + gsl_matrix_inv(m); +} + + -- cgit v1.2.3