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 <blaze/math/Aliases.h>
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 #include <blaze/util/NumericCast.h>
57 
58 
59 namespace blaze {
60 
61 //=================================================================================================
62 //
63 // BLAS WRAPPER FUNCTIONS (TRMV)
64 //
65 //=================================================================================================
66 
67 //*************************************************************************************************
70 #if BLAZE_BLAS_MODE
71 
72 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
73  CBLAS_DIAG diag, int n, const float* A, int lda, float* x,
74  int incX );
75 
76 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
77  CBLAS_DIAG diag, int n, const double* A, int lda, double* x,
78  int incX );
79 
80 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
81  CBLAS_DIAG diag, int n, const complex<float>* A, int lda,
82  complex<float>* x, int incX );
83 
84 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
85  CBLAS_DIAG diag, int n, const complex<double>* A, int lda,
86  complex<double>* x, int incX );
87 
88 template< typename VT, typename MT, bool SO >
89 BLAZE_ALWAYS_INLINE void trmv( DenseVector<VT,false>& x, const DenseMatrix<MT,SO>& A,
90  CBLAS_UPLO uplo );
91 
92 template< typename VT, typename MT, bool SO >
93 BLAZE_ALWAYS_INLINE void trmv( DenseVector<VT,true>& x, const DenseMatrix<MT,SO>& A,
94  CBLAS_UPLO uplo );
95 
96 #endif
97 
98 //*************************************************************************************************
99 
100 
101 //*************************************************************************************************
102 #if BLAZE_BLAS_MODE
103 
121 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
122  CBLAS_DIAG diag, int n, const float* A, int lda, float* x,
123  int incX )
124 {
125  cblas_strmv( order, uplo, transA, diag, n, A, lda, x, incX );
126 }
127 #endif
128 //*************************************************************************************************
129 
130 
131 //*************************************************************************************************
132 #if BLAZE_BLAS_MODE
133 
151 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
152  CBLAS_DIAG diag, int n, const double* A, int lda, double* x,
153  int incX )
154 {
155  cblas_dtrmv( order, uplo, transA, diag, n, A, lda, x, incX );
156 }
157 #endif
158 //*************************************************************************************************
159 
160 
161 //*************************************************************************************************
162 #if BLAZE_BLAS_MODE
163 
181 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
182  CBLAS_DIAG diag, int n, const complex<float>* A, int lda,
183  complex<float>* x, int incX )
184 {
185  BLAZE_STATIC_ASSERT( sizeof( complex<float> ) == 2UL*sizeof( float ) );
186 
187  cblas_ctrmv( order, uplo, transA, diag, n, reinterpret_cast<const float*>( A ),
188  lda, reinterpret_cast<float*>( x ), incX );
189 }
190 #endif
191 //*************************************************************************************************
192 
193 
194 //*************************************************************************************************
195 #if BLAZE_BLAS_MODE
196 
214 BLAZE_ALWAYS_INLINE void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
215  CBLAS_DIAG diag, int n, const complex<double>* A, int lda,
216  complex<double>* x, int incX )
217 {
218  BLAZE_STATIC_ASSERT( sizeof( complex<double> ) == 2UL*sizeof( double ) );
219 
220  cblas_ztrmv( order, uplo, transA, diag, n, reinterpret_cast<const double*>( A ),
221  lda, reinterpret_cast<double*>( x ), incX );
222 }
223 #endif
224 //*************************************************************************************************
225 
226 
227 //*************************************************************************************************
228 #if BLAZE_BLAS_MODE
229 
243 template< typename VT // Type of the target vector
244  , typename MT // Type of the matrix operand
245  , bool SO > // Storage order of the matrix operand
246 BLAZE_ALWAYS_INLINE void trmv( DenseVector<VT,false>& x, const DenseMatrix<MT,SO>& A,
247  CBLAS_UPLO uplo )
248 {
251 
254 
257 
258  BLAZE_INTERNAL_ASSERT( (~A).rows() == (~A).columns(), "Non-square triangular matrix detected" );
259  BLAZE_INTERNAL_ASSERT( uplo == CblasLower || uplo == CblasUpper, "Invalid uplo argument detected" );
260 
261  const int n ( numeric_cast<int>( (~A).rows() ) );
262  const int lda( numeric_cast<int>( (~A).spacing() ) );
263 
264  trmv( ( IsRowMajorMatrix<MT>::value )?( CblasRowMajor ):( CblasColMajor ),
265  uplo, CblasNoTrans, CblasNonUnit, n, (~A).data(), lda, (~x).data(), 1 );
266 }
267 #endif
268 //*************************************************************************************************
269 
270 
271 //*************************************************************************************************
272 #if BLAZE_BLAS_MODE
273 
287 template< typename VT // Type of the target vector
288  , typename MT // Type of the matrix operand
289  , bool SO > // Storage order of the matrix operand
290 BLAZE_ALWAYS_INLINE void trmv( DenseVector<VT,true>& x, const DenseMatrix<MT,SO>& A,
291  CBLAS_UPLO uplo )
292 {
295 
298 
301 
302  BLAZE_INTERNAL_ASSERT( (~A).rows() == (~A).columns(), "Non-square triangular matrix detected" );
303  BLAZE_INTERNAL_ASSERT( uplo == CblasLower || uplo == CblasUpper, "Invalid uplo argument detected" );
304 
305  const int n ( numeric_cast<int>( (~A).rows() ) );
306  const int lda( numeric_cast<int>( (~A).spacing() ) );
307 
308  trmv( ( IsRowMajorMatrix<MT>::value )?( CblasRowMajor ):( CblasColMajor ),
309  uplo, CblasTrans, CblasNonUnit, n, (~A).data(), lda, (~x).data(), 1 );
310 }
311 #endif
312 //*************************************************************************************************
313 
314 } // namespace blaze
315 
316 #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.
Cast operators for numeric types.
BLAZE_ALWAYS_INLINE 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
Compile time assertion.
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:506
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:490
BLAZE_ALWAYS_INLINE MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
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.
#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