public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/auto-numerical-bench:newinterfaces commit in: NumericInterface/NI_internal/
@ 2012-09-28 15:52 Andrea Arteaga
  0 siblings, 0 replies; only message in thread
From: Andrea Arteaga @ 2012-09-28 15:52 UTC (permalink / raw
  To: gentoo-commits

commit:     8fb800d2817e2087b4d2e04e30877c42a8b6cb50
Author:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
AuthorDate: Fri Sep 28 15:52:35 2012 +0000
Commit:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
CommitDate: Fri Sep 28 15:52:35 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=8fb800d2

Compelete the Fortran BLAS interface as requested by the current BLAS
operations.

---
 .../NI_internal/FortranDeclarations.hpp            |   30 ++++++++-
 NumericInterface/NI_internal/FortranInterface.hpp  |   65 +++++++++++++++++++-
 2 files changed, 89 insertions(+), 6 deletions(-)

diff --git a/NumericInterface/NI_internal/FortranDeclarations.hpp b/NumericInterface/NI_internal/FortranDeclarations.hpp
index fce99d2..9fe0b04 100644
--- a/NumericInterface/NI_internal/FortranDeclarations.hpp
+++ b/NumericInterface/NI_internal/FortranDeclarations.hpp
@@ -45,14 +45,36 @@ extern "C" {
      * LEVEL 2 BLAS *
      ****************/
 
-    void sgemv_(const char*, const int*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, const float*, const int*);
-    void dgemv_(const char*, const int*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, const double*, const int*);
+    void sgemv_(const char*, const int*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*);
+    void dgemv_(const char*, const int*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, double*, const int*);
+
+    void ssymv_(const char*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*);
+    void dsymv_(const char*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, double*, const int*);
 
     void strsv_(const char*, const char*, const char*, const int*, const float*, const int*, float*, const int*);
     void dtrsv_(const char*, const char*, const char*, const int*, const double*, const int*, double*, const int*);
 
-    void sger_(const int*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, const int*);
-    void dger_(const int*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, const int*);
+    void sger_(const int*, const int*, const float*, const float*, const int*, const float*, const int*, float*, const int*);
+    void dger_(const int*, const int*, const double*, const double*, const int*, const double*, const int*, double*, const int*);
+
+    void ssyr2_(const char*, const int*, const float*, const float*, const int*, const float*, const int*, float*, const int*);
+    void dsyr2_(const char*, const int*, const double*, const double*, const int*, const double*, const int*, double*, const int*);
+
+
+
+
+    /****************
+     * LEVEL 3 BLAS *
+     ****************/
+
+    void sgemm_(const char*, const char*, const int*, const int*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*);
+    void dgemm_(const char*, const char*, const int*, const int*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, double*, const int*);
+
+    void strmm_(const char*, const char*, const char*, const char*, const int*, const int*, const float*, const float*, const int*, float*, const int*);
+    void dtrmm_(const char*, const char*, const char*, const char*, const int*, const int*, const double*, const double*, const int*, double*, const int*);
+
+    void strsm_(const char*, const char*, const char*, const char*, const int*, const int*, const float*, const float*, const int*, float*, const int*);
+    void dtrsm_(const char*, const char*, const char*, const char*, const int*, const int*, const double*, const double*, const int*, double*, const int*);
 }
 
 

diff --git a/NumericInterface/NI_internal/FortranInterface.hpp b/NumericInterface/NI_internal/FortranInterface.hpp
index 0bdcf89..39dfa84 100644
--- a/NumericInterface/NI_internal/FortranInterface.hpp
+++ b/NumericInterface/NI_internal/FortranInterface.hpp
@@ -33,6 +33,9 @@ public:
 
     static const int ZERO;
     static const int ONE;
+    static const Scalar fONE;
+    static const char NoTrans;
+    static const char Trans;
 
 public:
     static std::string name()
@@ -78,11 +81,20 @@ public:
      * LEVEL 2 BLAS *
      ****************/
 
-    static void matrixVector(const char& trans, const int& M, const int& N,
+    static void matrixVector(const bool& trans, const int& M, const int& N,
             const Scalar& alpha, const Scalar* A, const Scalar* x,
             const Scalar& beta, Scalar* y)
     {
-        FORTFUNC(gemv)(&trans, &M, &N, &alpha, A, &M, x, &ONE, &beta, y, &ONE);
+        const int LDA = trans ? N : M;
+        const char tA = trans ? Trans : NoTrans;
+        FORTFUNC(gemv)(&tA, &M, &N, &alpha, A, &LDA, x, &ONE, &beta, y, &ONE);
+    }
+
+    static void symmetricMatrixVector(const char& uplo, const int& N,
+            const Scalar& alpha, const Scalar* A, const Scalar* x,
+            const Scalar& beta, Scalar* y)
+    {
+        FORTFUNC(symv)(&uplo, &N, &alpha, A, &N, x, &ONE, &beta, y, &ONE);
     }
 
     static void triangularSolveVector(const char& uplo, const char& diag,
@@ -96,10 +108,59 @@ public:
     {
         FORTFUNC(ger)(&M, &N, &alpha, x, &ONE, y, &ONE, A, &M);
     }
+
+    static void rank2update(const char& uplo, const int& N, const Scalar& alpha,
+            const Scalar* x, const Scalar* y, Scalar* A)
+    {
+        FORTFUNC(syr2)(&uplo, &N, &alpha, x, &ONE, y, &ONE, A, &N);
+    }
+
+
+
+    /****************
+     * LEVEL 3 BLAS *
+     ****************/
+
+    static void matrixMatrix(const bool& transA, const bool& transB,
+            const int& M, const int& N, const int& K,
+            const Scalar& alpha, const Scalar* A, const Scalar* B,
+            const Scalar& beta, Scalar* C)
+    {
+        int LDA = M, LDB = K;
+        char tA = NoTrans, tB = NoTrans;
+
+        if (transA) {
+            LDA = K;
+            tA = Trans;
+        }
+        if (transB) {
+            LDB = N;
+            tB = Trans;
+        }
+
+        const int LDB = transB ? N : K;
+        FORTFUNC(gemm)(&tA, &tB, &M, &N, &K, &alpha, A, &LDA, B, &LDB,
+                       &beta, C, &M);
+    }
+
+    static void triangularMatrixMatrix(const char& uplo,
+            const int& M, const int& N, const Scalar* A, Scalar* B)
+    {
+        FORTFUNC(trmm)("L", &uplo, "N", "N", &M, &N, &fONE, A, &M, B, &M);
+    }
+
+    static void triangularSolveMatrix(const char& uplo,
+            const int& M, const int& N, const Scalar* A, Scalar *B)
+    {
+        FORTFUNC(trsm)("L", &uplo, "N", "N", &M, &N, &fONE, A, &M, B, &M);
+    }
 };
 
 const int NumericInterface<NI_SCALAR>::ZERO = 0;
 const int NumericInterface<NI_SCALAR>::ONE = 1;
+const NI_SCALAR NumericInterface<NI_SCALAR>::fONE = 1.;
+const char NumericInterface<NI_SCALAR>::NoTrans = 'N';
+const char NumericInterface<NI_SCALAR>::Trans = 'T';
 
 
 


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-28 15:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-28 15:52 [gentoo-commits] proj/auto-numerical-bench:newinterfaces commit in: NumericInterface/NI_internal/ Andrea Arteaga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox