max@0: // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) max@0: // Copyright (C) 2008-2011 Conrad Sanderson max@0: // max@0: // This file is part of the Armadillo C++ library. max@0: // It is provided without any warranty of fitness max@0: // for any purpose. You can redistribute this file max@0: // and/or modify it under the terms of the GNU max@0: // Lesser General Public License (LGPL) as published max@0: // by the Free Software Foundation, either version 3 max@0: // of the License or (at your option) any later version. max@0: // (see http://www.opensource.org/licenses for more info) max@0: max@0: max@0: max@0: #ifdef ARMA_USE_BLAS max@0: max@0: max@0: //! \namespace blas namespace for BLAS functions max@0: namespace blas max@0: { max@0: max@0: max@0: template max@0: inline max@0: eT max@0: dot(const uword n_elem, const eT* x, const eT* y) max@0: { max@0: arma_ignore(n_elem); max@0: arma_ignore(x); max@0: arma_ignore(y); max@0: max@0: return eT(0); max@0: } max@0: max@0: max@0: max@0: template<> max@0: inline max@0: float max@0: dot(const uword n_elem, const float* x, const float* y) max@0: { max@0: blas_int n = blas_int(n_elem); max@0: blas_int inc = blas_int(1); max@0: max@0: return arma_fortran(arma_sdot)(&n, x, &inc, y, &inc); max@0: } max@0: max@0: max@0: max@0: template<> max@0: inline max@0: double max@0: dot(const uword n_elem, const double* x, const double* y) max@0: { max@0: blas_int n = blas_int(n_elem); max@0: blas_int inc = blas_int(1); max@0: max@0: return arma_fortran(arma_ddot)(&n, x, &inc, y, &inc); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: gemv(const char* transA, const blas_int* m, const blas_int* n, const eT* alpha, const eT* A, const blas_int* ldA, const eT* x, const blas_int* incx, const eT* beta, eT* y, const blas_int* incy) max@0: { max@0: arma_type_check((is_supported_blas_type::value == false)); max@0: max@0: if(is_float::value == true) max@0: { max@0: typedef float T; max@0: arma_fortran(arma_sgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy); max@0: } max@0: else max@0: if(is_double::value == true) max@0: { max@0: typedef double T; max@0: arma_fortran(arma_dgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy); max@0: } max@0: else max@0: if(is_supported_complex_float::value == true) max@0: { max@0: typedef std::complex T; max@0: arma_fortran(arma_cgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy); max@0: } max@0: else max@0: if(is_supported_complex_double::value == true) max@0: { max@0: typedef std::complex T; max@0: arma_fortran(arma_zgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy); max@0: } max@0: max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: void max@0: gemm(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const eT* alpha, const eT* A, const blas_int* ldA, const eT* B, const blas_int* ldB, const eT* beta, eT* C, const blas_int* ldC) max@0: { max@0: arma_type_check((is_supported_blas_type::value == false)); max@0: max@0: if(is_float::value == true) max@0: { max@0: typedef float T; max@0: arma_fortran(arma_sgemm)(transA, transB, m, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); max@0: } max@0: else max@0: if(is_double::value == true) max@0: { max@0: typedef double T; max@0: arma_fortran(arma_dgemm)(transA, transB, m, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); max@0: } max@0: else max@0: if(is_supported_complex_float::value == true) max@0: { max@0: typedef std::complex T; max@0: arma_fortran(arma_cgemm)(transA, transB, m, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); max@0: } max@0: else max@0: if(is_supported_complex_double::value == true) max@0: { max@0: typedef std::complex T; max@0: arma_fortran(arma_zgemm)(transA, transB, m, n, k, (const T*)alpha, (const T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); max@0: } max@0: max@0: } max@0: max@0: } max@0: max@0: max@0: #endif