Blaze 3.9
getrs.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_LAPACK_CLAPACK_GETRS_H_
36#define _BLAZE_MATH_LAPACK_CLAPACK_GETRS_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
44#include <blaze/util/Complex.h>
46#include <blaze/util/Types.h>
47
48
49//=================================================================================================
50//
51// LAPACK FORWARD DECLARATIONS
52//
53//=================================================================================================
54
55//*************************************************************************************************
57#if !defined(INTEL_MKL_VERSION) && !defined(BLAS_H)
58extern "C" {
59
60void sgetrs_( char* trans, blaze::blas_int_t* n, blaze::blas_int_t* nrhs, float* A,
61 blaze::blas_int_t* lda, blaze::blas_int_t* ipiv, float* B, blaze::blas_int_t* ldb,
63void dgetrs_( char* trans, blaze::blas_int_t* n, blaze::blas_int_t* nrhs, double* A,
64 blaze::blas_int_t* lda, blaze::blas_int_t* ipiv, double* B, blaze::blas_int_t* ldb,
66void cgetrs_( char* trans, blaze::blas_int_t* n, blaze::blas_int_t* nrhs, float* A,
67 blaze::blas_int_t* lda, blaze::blas_int_t* ipiv, float* B, blaze::blas_int_t* ldb,
69void zgetrs_( char* trans, blaze::blas_int_t* n, blaze::blas_int_t* nrhs, double* A,
70 blaze::blas_int_t* lda, blaze::blas_int_t* ipiv, double* B, blaze::blas_int_t* ldb,
72
73}
74#endif
76//*************************************************************************************************
77
78
79
80
81namespace blaze {
82
83//=================================================================================================
84//
85// LAPACK LU-BASED SUBSTITUTION FUNCTIONS (GETRS)
86//
87//=================================================================================================
88
89//*************************************************************************************************
92void getrs( char trans, blas_int_t n, blas_int_t nrhs, const float* A,
93 blas_int_t lda, const blas_int_t* ipiv, float* B,
94 blas_int_t ldb, blas_int_t* info );
95
96void getrs( char trans, blas_int_t n, blas_int_t nrhs, const double* A,
97 blas_int_t lda, const blas_int_t* ipiv, double* B,
98 blas_int_t ldb, blas_int_t* info );
99
100void getrs( char trans, blas_int_t n, blas_int_t nrhs, const complex<float>* A,
101 blas_int_t lda, const blas_int_t* ipiv, complex<float>* B,
102 blas_int_t ldb, blas_int_t* info );
103
104void getrs( char trans, blas_int_t n, blas_int_t nrhs, const complex<double>* A,
105 blas_int_t lda, const blas_int_t* ipiv, complex<double>* B,
106 blas_int_t ldb, blas_int_t* info );
108//*************************************************************************************************
109
110
111//*************************************************************************************************
150inline void getrs( char trans, blas_int_t n, blas_int_t nrhs, const float* A,
151 blas_int_t lda, const blas_int_t* ipiv, float* B,
152 blas_int_t ldb, blas_int_t* info )
153{
154#if defined(INTEL_MKL_VERSION)
155 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
156#endif
157
158 sgetrs_( &trans, &n, &nrhs, const_cast<float*>( A ), &lda,
159 const_cast<blas_int_t*>( ipiv ), B, &ldb, info
160#if !defined(INTEL_MKL_VERSION) && !defined(BLAS_H)
162#endif
163 );
164}
165//*************************************************************************************************
166
167
168//*************************************************************************************************
207inline void getrs( char trans, blas_int_t n, blas_int_t nrhs, const double* A,
208 blas_int_t lda, const blas_int_t* ipiv, double* B,
209 blas_int_t ldb, blas_int_t* info )
210{
211#if defined(INTEL_MKL_VERSION)
212 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
213#endif
214
215 dgetrs_( &trans, &n, &nrhs, const_cast<double*>( A ), &lda,
216 const_cast<blas_int_t*>( ipiv ), B, &ldb, info
217#if !defined(INTEL_MKL_VERSION) && !defined(BLAS_H)
219#endif
220 );
221}
222//*************************************************************************************************
223
224
225//*************************************************************************************************
264inline void getrs( char trans, blas_int_t n, blas_int_t nrhs, const complex<float>* A,
265 blas_int_t lda, const blas_int_t* ipiv, complex<float>* B,
266 blas_int_t ldb, blas_int_t* info )
267{
268 BLAZE_STATIC_ASSERT( sizeof( complex<float> ) == 2UL*sizeof( float ) );
269
270#if defined(INTEL_MKL_VERSION)
271 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
272 BLAZE_STATIC_ASSERT( sizeof( MKL_Complex8 ) == sizeof( complex<float> ) );
273 using ET = MKL_Complex8;
274#else
275 using ET = float;
276#endif
277
278 cgetrs_( &trans, &n, &nrhs, const_cast<ET*>( reinterpret_cast<const ET*>( A ) ),
279 &lda, const_cast<blas_int_t*>( ipiv ), reinterpret_cast<ET*>( B ), &ldb, info
280#if !defined(INTEL_MKL_VERSION) && !defined(BLAS_H)
282#endif
283 );
284}
285//*************************************************************************************************
286
287
288//*************************************************************************************************
327inline void getrs( char trans, blas_int_t n, blas_int_t nrhs, const complex<double>* A,
328 blas_int_t lda, const blas_int_t* ipiv, complex<double>* B,
329 blas_int_t ldb, blas_int_t* info )
330{
331 BLAZE_STATIC_ASSERT( sizeof( complex<double> ) == 2UL*sizeof( double ) );
332
333#if defined(INTEL_MKL_VERSION)
334 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
335 BLAZE_STATIC_ASSERT( sizeof( MKL_Complex16 ) == sizeof( complex<double> ) );
336 using ET = MKL_Complex16;
337#else
338 using ET = double;
339#endif
340
341 zgetrs_( &trans, &n, &nrhs, const_cast<ET*>( reinterpret_cast<const ET*>( A ) ),
342 &lda, const_cast<blas_int_t*>( ipiv ), reinterpret_cast<ET*>( B ), &ldb, info
343#if !defined(INTEL_MKL_VERSION) && !defined(BLAS_H)
345#endif
346 );
347}
348//*************************************************************************************************
349
350} // namespace blaze
351
352#endif
Header file for the complex data type.
Compile time assertion.
Complex data type of the Blaze library.
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
void getrs(const DenseMatrix< MT1, SO1 > &A, DenseMatrix< MT2, SO2 > &B, char trans, const blas_int_t *ipiv)
LAPACK kernel for the substitution step of solving a general linear system of equations ( ).
Definition: getrs.h:310
int32_t blas_int_t
Signed integer type used in the BLAS/LAPACK wrapper functions.
Definition: Types.h:64
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.
Definition: StaticAssert.h:112
size_t fortran_charlen_t
Type of the hidden arguments of character type within a Fortran forward declaration.
Definition: Types.h:186
Header file for basic BLAS type definitions.
Header file for basic type definitions.