35 #ifndef _BLAZE_MATH_BLAS_GEMM_H_ 36 #define _BLAZE_MATH_BLAS_GEMM_H_ 71 BLAZE_ALWAYS_INLINE void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
72 int m,
int n,
int k,
float alpha,
const float* A,
int lda,
73 const float* B,
int ldb,
float beta,
float* C,
int ldc );
75 BLAZE_ALWAYS_INLINE void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
76 int m,
int n,
int k,
double alpha,
const double* A,
int lda,
77 const double* B,
int ldb,
double beta,
float* C,
int ldc );
79 BLAZE_ALWAYS_INLINE void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
80 int m,
int n,
int k, complex<float> alpha,
const complex<float>* A,
81 int lda,
const complex<float>* B,
int ldb, complex<float> beta,
84 BLAZE_ALWAYS_INLINE void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
85 int m,
int n,
int k, complex<double> alpha,
const complex<double>* A,
86 int lda,
const complex<double>* B,
int ldb, complex<double> beta,
89 template<
typename MT1,
bool SO1,
typename MT2,
bool SO2,
typename MT3,
bool SO3,
typename ST >
91 const DenseMatrix<MT3,SO3>& B, ST alpha, ST beta );
123 BLAZE_ALWAYS_INLINE void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
124 int m,
int n,
int k,
float alpha,
const float* A,
int lda,
125 const float* B,
int ldb,
float beta,
float* C,
int ldc )
127 cblas_sgemm( order, transA, transB, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc );
158 BLAZE_ALWAYS_INLINE void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
159 int m,
int n,
int k,
double alpha,
const double* A,
int lda,
160 const double* B,
int ldb,
double beta,
double* C,
int ldc )
162 cblas_dgemm( order, transA, transB, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc );
193 BLAZE_ALWAYS_INLINE void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
194 int m,
int n,
int k, complex<float> alpha,
const complex<float>* A,
195 int lda,
const complex<float>* B,
int ldb, complex<float> beta,
196 complex<float>* C,
int ldc )
200 cblas_cgemm( order, transA, transB, m, n, k, reinterpret_cast<const float*>( &alpha ),
201 reinterpret_cast<const float*>( A ), lda, reinterpret_cast<const float*>( B ),
202 ldb, reinterpret_cast<const float*>( &beta ), reinterpret_cast<float*>( C ), ldc );
233 BLAZE_ALWAYS_INLINE void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
234 int m,
int n,
int k, complex<double> alpha,
const complex<double>* A,
235 int lda,
const complex<double>* B,
int ldb, complex<double> beta,
236 complex<double>* C,
int ldc )
240 cblas_zgemm( order, transA, transB, m, n, k, reinterpret_cast<const double*>( &alpha ),
241 reinterpret_cast<const double*>( A ), lda, reinterpret_cast<const double*>( B ),
242 ldb, reinterpret_cast<const double*>( &beta ), reinterpret_cast<double*>( C ), ldc );
265 template<
typename MT1
273 const DenseMatrix<MT3,SO3>& B, ST alpha, ST beta )
287 const int m ( numeric_cast<int>( (~A).
rows() ) );
288 const int n ( numeric_cast<int>( (~B).
columns() ) );
289 const int k ( numeric_cast<int>( (~A).
columns() ) );
290 const int lda( numeric_cast<int>( (~A).
spacing() ) );
291 const int ldb( numeric_cast<int>( (~B).
spacing() ) );
292 const int ldc( numeric_cast<int>( (~C).
spacing() ) );
294 gemm( ( IsRowMajorMatrix_v<MT1> )?( CblasRowMajor ):( CblasColMajor ),
295 ( SO1 == SO2 )?( CblasNoTrans ):( CblasTrans ),
296 ( SO1 == SO3 )?( CblasNoTrans ):( CblasTrans ),
297 m, n, k, alpha, (~A).
data(), lda, (~B).
data(), ldb, beta, (~C).
data(), ldc );
Constraint on the data type.
Header file for auxiliary alias declarations.
#define BLAZE_CONSTRAINT_MUST_HAVE_MUTABLE_DATA_ACCESS(T)
Constraint on the data type.In case the given data type T does not provide low-level data access to m...
Definition: MutableDataAccess.h:61
#define BLAZE_CONSTRAINT_MUST_HAVE_CONST_DATA_ACCESS(T)
Constraint on the data type.In case the given data type T does not provide low-level data access to c...
Definition: ConstDataAccess.h:61
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:81
Cast operators for numeric types.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:252
Constraint on the data type.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for the DenseMatrix base class.
Constraint on the data type.
System settings for the BLAS mode.
Header file for run time assertion macros.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a BLAS compatible data type (i...
Definition: BLASCompatible.h:61
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
Header file for the IsRowMajorMatrix type trait.
Header file for the complex data type.
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
System settings for the inline keywords.