trmv.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_BLAS_TRMV_H_
36 #define _BLAZE_MATH_BLAS_TRMV_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 (TRMV)
62 //
63 //=================================================================================================
64 
65 //*************************************************************************************************
68 #if BLAZE_BLAS_MODE
69 
70 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
71  CBLAS_DIAG diag, int n, const float* A, int lda, float* x,
72  int incX );
73 
74 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
75  CBLAS_DIAG diag, int n, const double* A, int lda, double* x,
76  int incX );
77 
78 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
79  CBLAS_DIAG diag, int n, const complex<float>* A, int lda,
80  complex<float>* x, int incX );
81 
82 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
83  CBLAS_DIAG diag, int n, const complex<double>* A, int lda,
84  complex<double>* x, int incX );
85 
86 template< typename VT, typename MT, bool SO >
87 BLAZE_ALWAYS_INLINE void trmv( DenseVector<VT,false>& x, const DenseMatrix<MT,SO>& A,
88  CBLAS_UPLO uplo );
89 
90 template< typename VT, typename MT, bool SO >
91 BLAZE_ALWAYS_INLINE void trmv( DenseVector<VT,true>& x, const DenseMatrix<MT,SO>& A,
92  CBLAS_UPLO uplo );
93 
94 #endif
95 
96 //*************************************************************************************************
97 
98 
99 //*************************************************************************************************
100 #if BLAZE_BLAS_MODE
101 
119 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
120  CBLAS_DIAG diag, int n, const float* A, int lda, float* x,
121  int incX )
122 {
123  cblas_strmv( order, uplo, transA, diag, n, A, lda, x, incX );
124 }
125 #endif
126 //*************************************************************************************************
127 
128 
129 //*************************************************************************************************
130 #if BLAZE_BLAS_MODE
131 
149 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
150  CBLAS_DIAG diag, int n, const double* A, int lda, double* x,
151  int incX )
152 {
153  cblas_dtrmv( order, uplo, transA, diag, n, A, lda, x, incX );
154 }
155 #endif
156 //*************************************************************************************************
157 
158 
159 //*************************************************************************************************
160 #if BLAZE_BLAS_MODE
161 
179 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
180  CBLAS_DIAG diag, int n, const complex<float>* A, int lda,
181  complex<float>* x, int incX )
182 {
183  cblas_ctrmv( order, uplo, transA, diag, n, A, lda, x, incX );
184 }
185 #endif
186 //*************************************************************************************************
187 
188 
189 //*************************************************************************************************
190 #if BLAZE_BLAS_MODE
191 
209 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
210  CBLAS_DIAG diag, int n, const complex<double>* A, int lda,
211  complex<double>* x, int incX )
212 {
213  cblas_ztrmv( order, uplo, transA, diag, n, A, lda, x, incX );
214 }
215 #endif
216 //*************************************************************************************************
217 
218 
219 //*************************************************************************************************
220 #if BLAZE_BLAS_MODE
221 
235 template< typename VT // Type of the target vector
236  , typename MT // Type of the matrix operand
237  , bool SO > // Storage order of the matrix operand
238 BLAZE_ALWAYS_INLINE void trmv( DenseVector<VT,false>& x, const DenseMatrix<MT,SO>& A,
239  CBLAS_UPLO uplo )
240 {
241  using boost::numeric_cast;
242 
245 
248 
251 
252  BLAZE_INTERNAL_ASSERT( (~A).rows() == (~A).columns(), "Non-square triangular matrix detected" );
253  BLAZE_INTERNAL_ASSERT( uplo == CblasLower || uplo == CblasUpper, "Invalid uplo argument detected" );
254 
255  const int n ( numeric_cast<int>( (~A).rows() ) );
256  const int lda( numeric_cast<int>( (~A).spacing() ) );
257 
258  trmv( ( IsRowMajorMatrix<MT>::value )?( CblasRowMajor ):( CblasColMajor ),
259  uplo, CblasNoTrans, CblasNonUnit, n, (~A).data(), lda, (~x).data(), 1 );
260 }
261 #endif
262 //*************************************************************************************************
263 
264 
265 //*************************************************************************************************
266 #if BLAZE_BLAS_MODE
267 
281 template< typename VT // Type of the target vector
282  , typename MT // Type of the matrix operand
283  , bool SO > // Storage order of the matrix operand
284 BLAZE_ALWAYS_INLINE void trmv( DenseVector<VT,true>& x, const DenseMatrix<MT,SO>& A,
285  CBLAS_UPLO uplo )
286 {
287  using boost::numeric_cast;
288 
291 
294 
297 
298  BLAZE_INTERNAL_ASSERT( (~A).rows() == (~A).columns(), "Non-square triangular matrix detected" );
299  BLAZE_INTERNAL_ASSERT( uplo == CblasLower || uplo == CblasUpper, "Invalid uplo argument detected" );
300 
301  const int n ( numeric_cast<int>( (~A).rows() ) );
302  const int lda( numeric_cast<int>( (~A).spacing() ) );
303 
304  trmv( ( IsRowMajorMatrix<MT>::value )?( CblasRowMajor ):( CblasColMajor ),
305  uplo, CblasTrans, CblasNonUnit, n, (~A).data(), lda, (~x).data(), 1 );
306 }
307 #endif
308 //*************************************************************************************************
309 
310 } // namespace blaze
311 
312 #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 DenseVector base class.
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