35 #ifndef _BLAZE_MATH_BLAS_LEVEL3_H_
36 #define _BLAZE_MATH_BLAS_LEVEL3_H_
43 #include <boost/cast.hpp>
72 template<
typename MT1,
bool SO1,
typename MT2,
bool SO2,
typename MT3,
bool SO3 >
74 const DenseMatrix<MT3,SO3>& B,
float alpha,
float beta );
76 template<
typename MT1,
bool SO1,
typename MT2,
bool SO2,
typename MT3,
bool SO3 >
78 const DenseMatrix<MT3,SO3>& B,
double alpha,
double beta );
80 template<
typename MT1,
bool SO1,
typename MT2,
bool SO2,
typename MT3,
bool SO3 >
82 const DenseMatrix<MT3,SO3>& B, complex<float> alpha, complex<float> beta );
84 template<
typename MT1,
bool SO1,
typename MT2,
bool SO2,
typename MT3,
bool SO3 >
86 const DenseMatrix<MT3,SO3>& B, complex<double> alpha, complex<double> beta );
88 template<
typename MT1,
bool SO1,
typename MT2,
bool SO2 >
90 CBLAS_SIDE side, CBLAS_UPLO uplo,
float alpha );
92 template<
typename MT1,
bool SO1,
typename MT2,
bool SO2 >
94 CBLAS_SIDE side, CBLAS_UPLO uplo,
double alpha );
96 template<
typename MT1,
bool SO1,
typename MT2,
bool SO2 >
98 CBLAS_SIDE side, CBLAS_UPLO uplo, complex<float> alpha );
100 template<
typename MT1,
bool SO1,
typename MT2,
bool SO2 >
102 CBLAS_SIDE side, CBLAS_UPLO uplo, complex<double> alpha );
127 template<
typename MT1
134 const DenseMatrix<MT3,SO3>& B,
float alpha,
float beta )
136 using boost::numeric_cast;
150 const int M ( numeric_cast<int>( (~A).
rows() ) );
151 const int N ( numeric_cast<int>( (~B).
columns() ) );
152 const int K ( numeric_cast<int>( (~A).
columns() ) );
153 const int lda( numeric_cast<int>( (~A).
spacing() ) );
154 const int ldb( numeric_cast<int>( (~B).
spacing() ) );
155 const int ldc( numeric_cast<int>( (~C).
spacing() ) );
157 if( IsSymmetric<MT2>::value && ( SO1 == SO3 ) ) {
158 cblas_ssymm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
160 ( IsRowMajorMatrix<MT2>::value )?( CblasLower ):( CblasUpper ),
161 M, N, alpha, (~A).data(), lda, (~B).data(), ldb, beta, (~C).data(), ldc );
163 else if( IsSymmetric<MT3>::value && ( SO1 == SO2 ) ) {
164 cblas_ssymm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
166 ( IsRowMajorMatrix<MT3>::value )?( CblasLower ):( CblasUpper ),
167 M, N, alpha, (~B).data(), ldb, (~A).data(), lda, beta, (~C).data(), ldc );
170 cblas_sgemm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
171 ( SO1 == SO2 )?( CblasNoTrans ):( CblasTrans ),
172 ( SO1 == SO3 )?( CblasNoTrans ):( CblasTrans ),
173 M, N, K, alpha, (~A).data(), lda, (~B).data(), ldb, beta, (~C).data(), ldc );
198 template<
typename MT1
205 const DenseMatrix<MT3,SO3>& B,
double alpha,
double beta )
207 using boost::numeric_cast;
221 const int M ( numeric_cast<int>( (~A).
rows() ) );
222 const int N ( numeric_cast<int>( (~B).
columns() ) );
223 const int K ( numeric_cast<int>( (~A).
columns() ) );
224 const int lda( numeric_cast<int>( (~A).
spacing() ) );
225 const int ldb( numeric_cast<int>( (~B).
spacing() ) );
226 const int ldc( numeric_cast<int>( (~C).
spacing() ) );
228 if( IsSymmetric<MT2>::value && ( SO1 == SO3 ) ) {
229 cblas_dsymm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
231 ( IsRowMajorMatrix<MT2>::value )?( CblasLower ):( CblasUpper ),
232 M, N, alpha, (~A).data(), lda, (~B).data(), ldb, beta, (~C).data(), ldc );
234 else if( IsSymmetric<MT3>::value && ( SO1 == SO2 ) ) {
235 cblas_dsymm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
237 ( IsRowMajorMatrix<MT3>::value )?( CblasLower ):( CblasUpper ),
238 M, N, alpha, (~B).data(), ldb, (~A).data(), lda, beta, (~C).data(), ldc );
241 cblas_dgemm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
242 ( SO1 == SO2 )?( CblasNoTrans ):( CblasTrans ),
243 ( SO1 == SO3 )?( CblasNoTrans ):( CblasTrans ),
244 M, N, K, alpha, (~A).data(), lda, (~B).data(), ldb, beta, (~C).data(), ldc );
269 template<
typename MT1
276 const DenseMatrix<MT3,SO3>& B, complex<float> alpha, complex<float> beta )
278 using boost::numeric_cast;
295 const int M ( numeric_cast<int>( (~A).
rows() ) );
296 const int N ( numeric_cast<int>( (~B).
columns() ) );
297 const int K ( numeric_cast<int>( (~A).
columns() ) );
298 const int lda( numeric_cast<int>( (~A).
spacing() ) );
299 const int ldb( numeric_cast<int>( (~B).
spacing() ) );
300 const int ldc( numeric_cast<int>( (~C).
spacing() ) );
302 if( IsSymmetric<MT2>::value && ( SO1 == SO3 ) ) {
303 cblas_csymm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
305 ( IsRowMajorMatrix<MT2>::value )?( CblasLower ):( CblasUpper ),
306 M, N, &alpha, (~A).data(), lda, (~B).data(), ldb, &beta, (~C).data(), ldc );
308 else if( IsSymmetric<MT3>::value && ( SO1 == SO2 ) ) {
309 cblas_csymm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
311 ( IsRowMajorMatrix<MT3>::value )?( CblasLower ):( CblasUpper ),
312 M, N, &alpha, (~B).data(), ldb, (~A).data(), lda, &beta, (~C).data(), ldc );
315 cblas_cgemm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
316 ( SO1 == SO2 )?( CblasNoTrans ):( CblasTrans ),
317 ( SO1 == SO3 )?( CblasNoTrans ):( CblasTrans ),
318 M, N, K, &alpha, (~A).data(), lda, (~B).data(), ldb, &beta, (~C).data(), ldc );
343 template<
typename MT1
350 const DenseMatrix<MT3,SO3>& B, complex<double> alpha, complex<double> beta )
352 using boost::numeric_cast;
369 const int M ( numeric_cast<int>( (~A).
rows() ) );
370 const int N ( numeric_cast<int>( (~B).
columns() ) );
371 const int K ( numeric_cast<int>( (~A).
columns() ) );
372 const int lda( numeric_cast<int>( (~A).
spacing() ) );
373 const int ldb( numeric_cast<int>( (~B).
spacing() ) );
374 const int ldc( numeric_cast<int>( (~C).
spacing() ) );
376 if( IsSymmetric<MT2>::value && ( SO1 == SO3 ) ) {
377 cblas_zsymm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
379 ( IsRowMajorMatrix<MT2>::value )?( CblasLower ):( CblasUpper ),
380 M, N, &alpha, (~A).data(), lda, (~B).data(), ldb, &beta, (~C).data(), ldc );
382 else if( IsSymmetric<MT3>::value && ( SO1 == SO2 ) ) {
383 cblas_zsymm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
385 ( IsRowMajorMatrix<MT3>::value )?( CblasLower ):( CblasUpper ),
386 M, N, &alpha, (~B).data(), ldb, (~A).data(), lda, &beta, (~C).data(), ldc );
389 cblas_zgemm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
390 ( SO1 == SO2 )?( CblasNoTrans ):( CblasTrans ),
391 ( SO1 == SO3 )?( CblasNoTrans ):( CblasTrans ),
392 M, N, K, &alpha, (~A).data(), lda, (~B).data(), ldb, &beta, (~C).data(), ldc );
417 template<
typename MT1
422 CBLAS_SIDE side, CBLAS_UPLO uplo,
float alpha )
424 using boost::numeric_cast;
439 const int M ( numeric_cast<int>( (~B).
rows() ) );
440 const int N ( numeric_cast<int>( (~B).
columns() ) );
441 const int lda( numeric_cast<int>( (~A).
spacing() ) );
442 const int ldb( numeric_cast<int>( (~B).
spacing() ) );
444 cblas_strmm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
446 ( SO1 == SO2 )?( uplo )
447 :( ( uplo == CblasLower )?( CblasUpper ):( CblasLower ) ),
448 ( SO1 == SO2 )?( CblasNoTrans ):( CblasTrans ),
450 M, N, alpha, (~A).data(), lda, (~B).data(), ldb );
474 template<
typename MT1
479 CBLAS_SIDE side, CBLAS_UPLO uplo,
double alpha )
481 using boost::numeric_cast;
496 const int M ( numeric_cast<int>( (~B).
rows() ) );
497 const int N ( numeric_cast<int>( (~B).
columns() ) );
498 const int lda( numeric_cast<int>( (~A).
spacing() ) );
499 const int ldb( numeric_cast<int>( (~B).
spacing() ) );
501 cblas_dtrmm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
503 ( SO1 == SO2 )?( uplo )
504 :( ( uplo == CblasLower )?( CblasUpper ):( CblasLower ) ),
505 ( SO1 == SO2 )?( CblasNoTrans ):( CblasTrans ),
507 M, N, alpha, (~A).data(), lda, (~B).data(), ldb );
532 template<
typename MT1
537 CBLAS_SIDE side, CBLAS_UPLO uplo, complex<float> alpha )
539 using boost::numeric_cast;
556 const int M ( numeric_cast<int>( (~B).
rows() ) );
557 const int N ( numeric_cast<int>( (~B).
columns() ) );
558 const int lda( numeric_cast<int>( (~A).
spacing() ) );
559 const int ldb( numeric_cast<int>( (~B).
spacing() ) );
561 cblas_ctrmm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
563 ( SO1 == SO2 )?( uplo )
564 :( ( uplo == CblasLower )?( CblasUpper ):( CblasLower ) ),
565 ( SO1 == SO2 )?( CblasNoTrans ):( CblasTrans ),
567 M, N, &alpha, (~A).data(), lda, (~B).data(), ldb );
592 template<
typename MT1
597 CBLAS_SIDE side, CBLAS_UPLO uplo, complex<double> alpha )
599 using boost::numeric_cast;
616 const int M ( numeric_cast<int>( (~B).
rows() ) );
617 const int N ( numeric_cast<int>( (~B).
columns() ) );
618 const int lda( numeric_cast<int>( (~A).
spacing() ) );
619 const int ldb( numeric_cast<int>( (~B).
spacing() ) );
621 cblas_ztrmm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
623 ( SO1 == SO2 )?( uplo )
624 :( ( uplo == CblasLower )?( CblasUpper ):( CblasLower ) ),
625 ( SO1 == SO2 )?( CblasNoTrans ):( CblasTrans ),
627 M, N, &alpha, (~A).data(), lda, (~B).data(), ldb );
Constraint on the data type.
#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:79
#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:79
#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:118
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
#define BLAZE_CONSTRAINT_MUST_BE_FLOAT_TYPE(T)
Constraint on the data type.This compile time constraint checks that the given data type T is of type...
Definition: Float.h:80
Constraint on the data type.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
#define BLAZE_CONSTRAINT_MUST_BE_DOUBLE_TYPE(T)
Constraint on the data type.This compile time constraint checks that the given data type T is of type...
Definition: Double.h:80
Header file for the DenseMatrix base class.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2505
Constraint on the data type.
const bool spacing
Adding an additional spacing line between two log messages.This setting gives the opportunity to add ...
Definition: Logging.h:70
System settings for the BLAS mode.
Header file for run time assertion macros.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_COMPLEX_TYPE(T)
Constraint on the data type.This compile time constraint checks that the given data type T is a compl...
Definition: Complex.h:80
Header file for the IsRowMajorMatrix type trait.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
Header file for the complex data type.
Constraint on the data type.
System settings for the inline keywords.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101