From: "Andrea Arteaga" <andyspiros@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/auto-numerical-bench:newinterfaces commit in: NumericInterface/NI_internal/
Date: Fri, 28 Sep 2012 15:52:57 +0000 (UTC) [thread overview]
Message-ID: <1348847555.8fb800d2817e2087b4d2e04e30877c42a8b6cb50.spiros@gentoo> (raw)
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';
reply other threads:[~2012-09-28 15:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1348847555.8fb800d2817e2087b4d2e04e30877c42a8b6cb50.spiros@gentoo \
--to=andyspiros@gmail.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox