trmm.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_BLAS_TRMM_H_
36 #define _BLAZE_MATH_BLAS_TRMM_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <boost/cast.hpp>
51 #include <blaze/system/BLAS.h>
52 #include <blaze/system/Inline.h>
53 #include <blaze/util/Assert.h>
54 #include <blaze/util/Complex.h>
55 
56 
57 namespace blaze {
58 
59 //=================================================================================================
60 //
61 // BLAS WRAPPER FUNCTIONS (TRMM)
62 //
63 //=================================================================================================
64 
65 //*************************************************************************************************
68 #if BLAZE_BLAS_MODE
69 
70 BLAZE_ALWAYS_INLINE void trmm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo,
71  CBLAS_TRANSPOSE transA, CBLAS_DIAG diag, int m, int n,
72  float alpha, const float* A, int lda, float* B, int ldb );
73 
74 BLAZE_ALWAYS_INLINE void trmm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo,
75  CBLAS_TRANSPOSE transA, CBLAS_DIAG diag, int m, int n,
76  double alpha, const double* A, int lda, double* B, int ldb );
77 
78 BLAZE_ALWAYS_INLINE void trmm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo,
79  CBLAS_TRANSPOSE transA, CBLAS_DIAG diag, int m, int n,
80  complex<float> alpha, const complex<float>* A, int lda,
81  complex<float>* B, int ldb );
82 
83 BLAZE_ALWAYS_INLINE void trmm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo,
84  CBLAS_TRANSPOSE transA, CBLAS_DIAG diag, int m, int n,
85  complex<double> alpha, const complex<double>* A, int lda,
86  complex<double>* B, int ldb );
87 
88 template< typename MT1, bool SO1, typename MT2, bool SO2, typename ST >
89 BLAZE_ALWAYS_INLINE void trmm( DenseMatrix<MT1,SO1>& B, const DenseMatrix<MT2,SO2>& A,
90  CBLAS_SIDE side, CBLAS_UPLO uplo, ST alpha );
91 
92 #endif
93 
94 //*************************************************************************************************
95 
96 
97 //*************************************************************************************************
98 #if BLAZE_BLAS_MODE
99 
120 BLAZE_ALWAYS_INLINE void trmm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo,
121  CBLAS_TRANSPOSE transA, CBLAS_DIAG diag, int m, int n,
122  float alpha, const float* A, int lda, float* B, int ldb )
123 {
124  cblas_strmm( order, side, uplo, transA, diag, m, n, alpha, A, lda, B, ldb );
125 }
126 #endif
127 //*************************************************************************************************
128 
129 
130 //*************************************************************************************************
131 #if BLAZE_BLAS_MODE
132 
153 BLAZE_ALWAYS_INLINE void trmm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo,
154  CBLAS_TRANSPOSE transA, CBLAS_DIAG diag, int m, int n,
155  double alpha, const double* A, int lda, double* B, int ldb )
156 {
157  cblas_dtrmm( order, side, uplo, transA, diag, m, n, alpha, A, lda, B, ldb );
158 }
159 #endif
160 //*************************************************************************************************
161 
162 
163 //*************************************************************************************************
164 #if BLAZE_BLAS_MODE
165 
186 BLAZE_ALWAYS_INLINE void trmm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo,
187  CBLAS_TRANSPOSE transA, CBLAS_DIAG diag, int m, int n,
188  complex<float> alpha, const complex<float>* A, int lda,
189  complex<float>* B, int ldb )
190 {
191  cblas_ctrmm( order, side, uplo, transA, diag, m, n, &alpha, A, lda, B, ldb );
192 }
193 #endif
194 //*************************************************************************************************
195 
196 
197 //*************************************************************************************************
198 #if BLAZE_BLAS_MODE
199 
220 BLAZE_ALWAYS_INLINE void trmm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo,
221  CBLAS_TRANSPOSE transA, CBLAS_DIAG diag, int m, int n,
222  complex<double> alpha, const complex<double>* A, int lda,
223  complex<double>* B, int ldb )
224 {
225  cblas_ztrmm( order, side, uplo, transA, diag, m, n, &alpha, A, lda, B, ldb );
226 }
227 #endif
228 //*************************************************************************************************
229 
230 
231 //*************************************************************************************************
232 #if BLAZE_BLAS_MODE
233 
249 template< typename MT1 // Type of the left-hand side target matrix
250  , bool SO1 // Storage order of the left-hand side target matrix
251  , typename MT2 // Type of the left-hand side matrix operand
252  , bool SO2 // Storage order of the left-hand side matrix operand
253  , typename ST > // Type of the scalar factors
254 BLAZE_ALWAYS_INLINE void trmm( DenseMatrix<MT1,SO1>& B, const DenseMatrix<MT2,SO2>& A,
255  CBLAS_SIDE side, CBLAS_UPLO uplo, ST alpha )
256 {
257  using boost::numeric_cast;
258 
261 
264 
267 
268  BLAZE_INTERNAL_ASSERT( (~A).rows() == (~A).columns(), "Non-square triangular matrix detected" );
269  BLAZE_INTERNAL_ASSERT( side == CblasLeft || side == CblasRight, "Invalid side argument detected" );
270  BLAZE_INTERNAL_ASSERT( uplo == CblasLower || uplo == CblasUpper, "Invalid uplo argument detected" );
271 
272  const int m ( numeric_cast<int>( (~B).rows() ) );
273  const int n ( numeric_cast<int>( (~B).columns() ) );
274  const int lda( numeric_cast<int>( (~A).spacing() ) );
275  const int ldb( numeric_cast<int>( (~B).spacing() ) );
276 
277  trmm( ( IsRowMajorMatrix<MT1>::value )?( CblasRowMajor ):( CblasColMajor ),
278  side,
279  ( SO1 == SO2 )?( uplo ):( ( uplo == CblasLower )?( CblasUpper ):( CblasLower ) ),
280  ( SO1 == SO2 )?( CblasNoTrans ):( CblasTrans ),
281  CblasNonUnit,
282  m, n, alpha, (~A).data(), lda, (~B).data(), ldb );
283 }
284 #endif
285 //*************************************************************************************************
286 
287 } // namespace blaze
288 
289 #endif
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
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:308
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
Header file for the DenseMatrix base class.
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Constraint on the data type.
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_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:79
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:324
Header file for the complex 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