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>
44 #include <blaze/math/Aliases.h>
52 #include <blaze/system/BLAS.h>
53 #include <blaze/system/Inline.h>
54 #include <blaze/util/Assert.h>
55 #include <blaze/util/Complex.h>
56 
57 
58 namespace blaze {
59 
60 //=================================================================================================
61 //
62 // BLAS WRAPPER FUNCTIONS (TRMV)
63 //
64 //=================================================================================================
65 
66 //*************************************************************************************************
69 #if BLAZE_BLAS_MODE
70 
71 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
72  CBLAS_DIAG diag, int n, const float* A, int lda, float* x,
73  int incX );
74 
75 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
76  CBLAS_DIAG diag, int n, const double* A, int lda, double* x,
77  int incX );
78 
79 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
80  CBLAS_DIAG diag, int n, const complex<float>* A, int lda,
81  complex<float>* x, int incX );
82 
83 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
84  CBLAS_DIAG diag, int n, const complex<double>* A, int lda,
85  complex<double>* x, int incX );
86 
87 template< typename VT, typename MT, bool SO >
88 BLAZE_ALWAYS_INLINE void trmv( DenseVector<VT,false>& x, const DenseMatrix<MT,SO>& A,
89  CBLAS_UPLO uplo );
90 
91 template< typename VT, typename MT, bool SO >
92 BLAZE_ALWAYS_INLINE void trmv( DenseVector<VT,true>& x, const DenseMatrix<MT,SO>& A,
93  CBLAS_UPLO uplo );
94 
95 #endif
96 
97 //*************************************************************************************************
98 
99 
100 //*************************************************************************************************
101 #if BLAZE_BLAS_MODE
102 
120 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
121  CBLAS_DIAG diag, int n, const float* A, int lda, float* x,
122  int incX )
123 {
124  cblas_strmv( order, uplo, transA, diag, n, A, lda, x, incX );
125 }
126 #endif
127 //*************************************************************************************************
128 
129 
130 //*************************************************************************************************
131 #if BLAZE_BLAS_MODE
132 
150 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
151  CBLAS_DIAG diag, int n, const double* A, int lda, double* x,
152  int incX )
153 {
154  cblas_dtrmv( order, uplo, transA, diag, n, A, lda, x, incX );
155 }
156 #endif
157 //*************************************************************************************************
158 
159 
160 //*************************************************************************************************
161 #if BLAZE_BLAS_MODE
162 
180 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
181  CBLAS_DIAG diag, int n, const complex<float>* A, int lda,
182  complex<float>* x, int incX )
183 {
184  cblas_ctrmv( order, uplo, transA, diag, n, A, lda, x, incX );
185 }
186 #endif
187 //*************************************************************************************************
188 
189 
190 //*************************************************************************************************
191 #if BLAZE_BLAS_MODE
192 
210 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
211  CBLAS_DIAG diag, int n, const complex<double>* A, int lda,
212  complex<double>* x, int incX )
213 {
214  cblas_ztrmv( order, uplo, transA, diag, n, A, lda, x, incX );
215 }
216 #endif
217 //*************************************************************************************************
218 
219 
220 //*************************************************************************************************
221 #if BLAZE_BLAS_MODE
222 
236 template< typename VT // Type of the target vector
237  , typename MT // Type of the matrix operand
238  , bool SO > // Storage order of the matrix operand
239 BLAZE_ALWAYS_INLINE void trmv( DenseVector<VT,false>& x, const DenseMatrix<MT,SO>& A,
240  CBLAS_UPLO uplo )
241 {
242  using boost::numeric_cast;
243 
246 
249 
252 
253  BLAZE_INTERNAL_ASSERT( (~A).rows() == (~A).columns(), "Non-square triangular matrix detected" );
254  BLAZE_INTERNAL_ASSERT( uplo == CblasLower || uplo == CblasUpper, "Invalid uplo argument detected" );
255 
256  const int n ( numeric_cast<int>( (~A).rows() ) );
257  const int lda( numeric_cast<int>( (~A).spacing() ) );
258 
259  trmv( ( IsRowMajorMatrix<MT>::value )?( CblasRowMajor ):( CblasColMajor ),
260  uplo, CblasNoTrans, CblasNonUnit, n, (~A).data(), lda, (~x).data(), 1 );
261 }
262 #endif
263 //*************************************************************************************************
264 
265 
266 //*************************************************************************************************
267 #if BLAZE_BLAS_MODE
268 
282 template< typename VT // Type of the target vector
283  , typename MT // Type of the matrix operand
284  , bool SO > // Storage order of the matrix operand
285 BLAZE_ALWAYS_INLINE void trmv( DenseVector<VT,true>& x, const DenseMatrix<MT,SO>& A,
286  CBLAS_UPLO uplo )
287 {
288  using boost::numeric_cast;
289 
292 
295 
298 
299  BLAZE_INTERNAL_ASSERT( (~A).rows() == (~A).columns(), "Non-square triangular matrix detected" );
300  BLAZE_INTERNAL_ASSERT( uplo == CblasLower || uplo == CblasUpper, "Invalid uplo argument detected" );
301 
302  const int n ( numeric_cast<int>( (~A).rows() ) );
303  const int lda( numeric_cast<int>( (~A).spacing() ) );
304 
305  trmv( ( IsRowMajorMatrix<MT>::value )?( CblasRowMajor ):( CblasColMajor ),
306  uplo, CblasTrans, CblasNonUnit, n, (~A).data(), lda, (~x).data(), 1 );
307 }
308 #endif
309 //*************************************************************************************************
310 
311 } // namespace blaze
312 
313 #endif
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
#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
Header file for the DenseVector base class.
constexpr bool spacing
Adding an additional spacing line between two log messages.This setting gives the opportunity to add ...
Definition: Logging.h:70
Constraint on the data type.
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.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:330
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
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:314
Header file for the IsRowMajorMatrix type trait.
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