Blaze 3.9
trsm.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_BLAS_TRSM_H_
36#define _BLAZE_MATH_BLAS_TRSM_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <blaze/math/Aliases.h>
52#include <blaze/system/BLAS.h>
53#include <blaze/util/Assert.h>
54#include <blaze/util/Complex.h>
56
57
58namespace blaze {
59
60//=================================================================================================
61//
62// BLAS TRIANGULAR LSE SOLVER FUNCTIONS (TRSM)
63//
64//=================================================================================================
65
66//*************************************************************************************************
69#if BLAZE_BLAS_MODE
70
71template< typename MT, bool SO, typename VT, bool TF, typename ST >
72void trsm( const DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& b,
73 CBLAS_SIDE side, CBLAS_UPLO uplo, ST alpha );
74
75template< typename MT1, bool SO1, typename MT2, bool SO2, typename ST >
76void trsm( const DenseMatrix<MT1,SO1>& A, DenseMatrix<MT2,SO2>& B,
77 CBLAS_SIDE side, CBLAS_UPLO uplo, ST alpha );
78
79#endif
81//*************************************************************************************************
82
83
84//*************************************************************************************************
85#if BLAZE_BLAS_MODE
108template< typename MT // Type of the system matrix
109 , bool SO // Storage order of the system matrix
110 , typename VT // Type of the target vector
111 , bool TF // Storage order of the target vector
112 , typename ST > // Type of the scalar factor
113inline void trsm( const DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& b,
114 CBLAS_SIDE side, CBLAS_UPLO uplo, ST alpha )
115{
118
121
124
125 BLAZE_INTERNAL_ASSERT( (*A).rows() == (*A).columns(), "Non-square triangular matrix detected" );
126 BLAZE_INTERNAL_ASSERT( side == CblasLeft || side == CblasRight, "Invalid side argument detected" );
127 BLAZE_INTERNAL_ASSERT( uplo == CblasLower || uplo == CblasUpper, "Invalid uplo argument detected" );
128
129 const blas_int_t m ( ( side == CblasLeft )?( numeric_cast<blas_int_t>( (*b).size() ) ):( 1 ) );
130 const blas_int_t n ( ( side == CblasRight )?( numeric_cast<blas_int_t>( (*b).size() ) ):( 1 ) );
131 const blas_int_t lda( numeric_cast<blas_int_t>( (*A).spacing() ) );
132 const blas_int_t ldb( ( IsRowMajorMatrix_v<MT> )?( n ):( m ) );
133
134 trsm( ( IsRowMajorMatrix_v<MT> )?( CblasRowMajor ):( CblasColMajor ),
135 side,
136 uplo,
137 CblasNoTrans,
138 CblasNonUnit,
139 m, n, alpha, (*A).data(), lda, (*b).data(), ldb );
140}
141#endif
142//*************************************************************************************************
143
144
145//*************************************************************************************************
146#if BLAZE_BLAS_MODE
169template< typename MT1 // Type of the system matrix
170 , bool SO1 // Storage order of the system matrix
171 , typename MT2 // Type of the target matrix
172 , bool SO2 // Storage order of the target matrix
173 , typename ST > // Type of the scalar factor
174inline void trsm( const DenseMatrix<MT1,SO1>& A, DenseMatrix<MT2,SO2>& B,
175 CBLAS_SIDE side, CBLAS_UPLO uplo, ST alpha )
176{
179
182
185
186 BLAZE_INTERNAL_ASSERT( (*A).rows() == (*A).columns(), "Non-square triangular matrix detected" );
187 BLAZE_INTERNAL_ASSERT( side == CblasLeft || side == CblasRight, "Invalid side argument detected" );
188 BLAZE_INTERNAL_ASSERT( uplo == CblasLower || uplo == CblasUpper, "Invalid uplo argument detected" );
189
190 const blas_int_t m ( numeric_cast<blas_int_t>( (*B).rows() ) );
191 const blas_int_t n ( numeric_cast<blas_int_t>( (*B).columns() ) );
192 const blas_int_t lda( numeric_cast<blas_int_t>( (*A).spacing() ) );
193 const blas_int_t ldb( numeric_cast<blas_int_t>( (*B).spacing() ) );
194
195 trsm( ( IsRowMajorMatrix_v<MT2> )?( CblasRowMajor ):( CblasColMajor ),
196 side,
197 ( SO1 == SO2 )?( uplo ):( ( uplo == CblasLower )?( CblasUpper ):( CblasLower ) ),
198 ( SO1 == SO2 )?( CblasNoTrans ):( CblasTrans ),
199 CblasNonUnit,
200 m, n, alpha, (*A).data(), lda, (*B).data(), ldb );
201}
202#endif
203//*************************************************************************************************
204
205} // namespace blaze
206
207#endif
Header file for auxiliary alias declarations.
Header file for run time assertion macros.
Constraint on the data type.
Header file for the complex data type.
Constraint on the data type.
Header file for the IsRowMajorMatrix type trait.
Constraint on the data type.
Cast operators for numeric types.
Header file for the CBLAS trsm wrapper functions.
Constraint on the data type.
Header file for the DenseMatrix base class.
Header file for the DenseVector base class.
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.
Definition: BLASCompatible.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.
Definition: Computation.h:81
#define BLAZE_CONSTRAINT_MUST_HAVE_MUTABLE_DATA_ACCESS(T)
Constraint on the data type.
Definition: MutableDataAccess.h:61
#define BLAZE_CONSTRAINT_MUST_HAVE_CONST_DATA_ACCESS(T)
Constraint on the data type.
Definition: ConstDataAccess.h:61
int32_t blas_int_t
Signed integer type used in the BLAS/LAPACK wrapper functions.
Definition: Types.h:64
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
System settings for the BLAS mode.