Blaze 3.9
gemm.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_BLAS_CBLAS_GEMM_H_
36#define _BLAZE_MATH_BLAS_CBLAS_GEMM_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
44#include <blaze/system/BLAS.h>
45#include <blaze/util/Complex.h>
47
48
49namespace blaze {
50
51//=================================================================================================
52//
53// BLAS GENERAL MATRIX MULTIPLICATION FUNCTIONS (GEMM)
54//
55//=================================================================================================
56
57//*************************************************************************************************
60#if BLAZE_BLAS_MODE
61
62void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
63 blas_int_t m, blas_int_t n, blas_int_t k, float alpha, const float* A,
64 blas_int_t lda, const float* B, blas_int_t ldb, float beta, float* C,
65 blas_int_t ldc );
66
67void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
68 blas_int_t m, blas_int_t n, blas_int_t k, double alpha, const double* A,
69 blas_int_t lda, const double* B, blas_int_t ldb, double beta, float* C,
70 blas_int_t ldc );
71
72void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
74 const complex<float>* A, blas_int_t lda, const complex<float>* B,
76
77void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
79 const complex<double>* A, blas_int_t lda, const complex<double>* B,
81
82#endif
84//*************************************************************************************************
85
86
87//*************************************************************************************************
88#if BLAZE_BLAS_MODE
116inline void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
117 blas_int_t m, blas_int_t n, blas_int_t k, float alpha, const float* A,
118 blas_int_t lda, const float* B, blas_int_t ldb, float beta, float* C,
119 blas_int_t ldc )
120{
121 cblas_sgemm( order, transA, transB, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc );
122}
123#endif
124//*************************************************************************************************
125
126
127//*************************************************************************************************
128#if BLAZE_BLAS_MODE
156inline void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
157 blas_int_t m, blas_int_t n, blas_int_t k, double alpha, const double* A,
158 blas_int_t lda, const double* B, blas_int_t ldb, double beta, double* C,
159 blas_int_t ldc )
160{
161 cblas_dgemm( order, transA, transB, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc );
162}
163#endif
164//*************************************************************************************************
165
166
167//*************************************************************************************************
168#if BLAZE_BLAS_MODE
196inline void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
198 const complex<float>* A, blas_int_t lda, const complex<float>* B,
200{
201 BLAZE_STATIC_ASSERT( sizeof( complex<float> ) == 2UL*sizeof( float ) );
202
203 cblas_cgemm( order, transA, transB, m, n, k, reinterpret_cast<const float*>( &alpha ),
204 reinterpret_cast<const float*>( A ), lda, reinterpret_cast<const float*>( B ),
205 ldb, reinterpret_cast<const float*>( &beta ), reinterpret_cast<float*>( C ), ldc );
206}
207#endif
208//*************************************************************************************************
209
210
211//*************************************************************************************************
212#if BLAZE_BLAS_MODE
240inline void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
242 const complex<double>* A, blas_int_t lda, const complex<double>* B,
244{
245 BLAZE_STATIC_ASSERT( sizeof( complex<double> ) == 2UL*sizeof( double ) );
246
247 cblas_zgemm( order, transA, transB, m, n, k, reinterpret_cast<const double*>( &alpha ),
248 reinterpret_cast<const double*>( A ), lda, reinterpret_cast<const double*>( B ),
249 ldb, reinterpret_cast<const double*>( &beta ), reinterpret_cast<double*>( C ), ldc );
250}
251#endif
252//*************************************************************************************************
253
254} // namespace blaze
255
256#endif
Header file for the complex data type.
Compile time assertion.
Complex data type of the Blaze library.
int32_t blas_int_t
Signed integer type used in the BLAS/LAPACK wrapper functions.
Definition: Types.h:64
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.
Definition: StaticAssert.h:112
Header file for basic BLAS type definitions.
System settings for the BLAS mode.