From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id A54B4138010 for ; Fri, 28 Sep 2012 15:53:07 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 141F8E0574; Fri, 28 Sep 2012 15:52:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B1C8FE0574 for ; Fri, 28 Sep 2012 15:52:59 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9534333C6EF for ; Fri, 28 Sep 2012 15:52:58 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 3564AE544A for ; Fri, 28 Sep 2012 15:52:57 +0000 (UTC) From: "Andrea Arteaga" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andrea Arteaga" Message-ID: <1348847555.8fb800d2817e2087b4d2e04e30877c42a8b6cb50.spiros@gentoo> Subject: [gentoo-commits] proj/auto-numerical-bench:newinterfaces commit in: NumericInterface/NI_internal/ X-VCS-Repository: proj/auto-numerical-bench X-VCS-Files: NumericInterface/NI_internal/FortranDeclarations.hpp NumericInterface/NI_internal/FortranInterface.hpp X-VCS-Directories: NumericInterface/NI_internal/ X-VCS-Committer: spiros X-VCS-Committer-Name: Andrea Arteaga X-VCS-Revision: 8fb800d2817e2087b4d2e04e30877c42a8b6cb50 X-VCS-Branch: newinterfaces Date: Fri, 28 Sep 2012 15:52:57 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: c17977ec-0ddc-4e12-8c8f-1800994082ed X-Archives-Hash: 5c97fb4cbddf6363929dfebd0be6dcca commit: 8fb800d2817e2087b4d2e04e30877c42a8b6cb50 Author: Andrea Arteaga gmail com> AuthorDate: Fri Sep 28 15:52:35 2012 +0000 Commit: Andrea Arteaga gmail 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::ZERO = 0; const int NumericInterface::ONE = 1; +const NI_SCALAR NumericInterface::fONE = 1.; +const char NumericInterface::NoTrans = 'N'; +const char NumericInterface::Trans = 'T';