aboutsummaryrefslogtreecommitdiff
path: root/src/fastblas.cpp
diff options
context:
space:
mode:
authorPjotr Prins2020-05-22 07:15:37 -0500
committerPjotr Prins2020-05-22 07:15:37 -0500
commit8c82a8294483ffac4d8e9635376723f26a8ae27b (patch)
treec987e3646be820fe703452ad250979e4f3c112a9 /src/fastblas.cpp
parentf112b0fa5f29651b5af8cb3bd1c2933f010c2960 (diff)
downloadpangemma-8c82a8294483ffac4d8e9635376723f26a8ae27b.tar.gz
Fixes for gcc (GCC) 10.1.0
Started to remove eigenlib (again)
Diffstat (limited to 'src/fastblas.cpp')
-rw-r--r--src/fastblas.cpp39
1 files changed, 35 insertions, 4 deletions
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 <http://www.gnu.org/licenses/>.
*/
-#include "gsl/gsl_matrix.h"
+// #include "gsl/gsl_matrix.h"
#include <algorithm> // std::min
#include <cmath>
#include <iomanip>
@@ -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 <gsl/gsl_permutation.h>
+#include <gsl/gsl_linalg.h>
+
+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);
+}
+
+