From 56ffd28f8e5e5746f6a2665ac3ef7ee78a1efc28 Mon Sep 17 00:00:00 2001
From: Gauthier Becker <gauthierbecker@gmail.com>
Date: Mon, 21 Feb 2011 21:09:39 +0000
Subject: [PATCH] fix bug

---
 Numeric/fullMatrix.cpp | 22 ++++++++++++++++++++++
 Numeric/fullMatrix.h   | 10 +++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/Numeric/fullMatrix.cpp b/Numeric/fullMatrix.cpp
index b47830f41f..342183ce78 100644
--- a/Numeric/fullMatrix.cpp
+++ b/Numeric/fullMatrix.cpp
@@ -177,6 +177,28 @@ void fullMatrix<double>::multWithATranspose(const fullVector<double> &x, const i
 
 }
 
+template<>
+void fullMatrix<double>::gemmWithAtranspose(const fullMatrix<double> &a, const fullMatrix<double> &b,
+                                             double alpha, double beta)
+{
+  int M = size2(), N = size2(), K = a.size1();
+  int LDA = a.size1(), LDB = b.size1(), LDC = size1();
+  F77NAME(dgemm)("T", "N", &M, &N, &K, &alpha, a._data, &LDA, b._data, &LDB,
+                 &beta, _data, &LDC);
+}
+
+template<>
+void fullMatrix<std::complex<double> >::gemmWithAtranspose(const fullMatrix<std::complex<double> > &a,
+                                                             const fullMatrix<std::complex<double> > &b,
+                                                             std::complex<double> alpha,
+                                                             std::complex<double> beta)
+{
+  int M = size2(), N = size2(), K = a.size1();
+  int LDA = a.size1(), LDB = b.size1(), LDC = size1();
+  F77NAME(zgemm)("T", "N", &M, &N, &K, &alpha, a._data, &LDA, b._data, &LDB,
+                 &beta, _data, &LDC);
+}
+
 #endif
 
 
diff --git a/Numeric/fullMatrix.h b/Numeric/fullMatrix.h
index cc5fa06173..85a250c70e 100644
--- a/Numeric/fullMatrix.h
+++ b/Numeric/fullMatrix.h
@@ -552,7 +552,15 @@ class fullMatrix
      _data[cind+i] = x(i);
   }
 
+  void gemmWithAtranspose(const fullMatrix<scalar> &a, const fullMatrix<scalar> &b,
+            scalar alpha=1., scalar beta=1.)
+#if !defined(HAVE_BLAS)
+  {
+    Msg::Error("gemmWithAtranspose is only available with blas. If blas is not installed please transpose a before used gemm_naive");
+  }
+#endif
+  ;
+
   static void registerBindings(binding *b);
 };
-
 #endif
-- 
GitLab