Blaze 3.9
gesv.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_LAPACK_CLAPACK_GESV_H_
36#define _BLAZE_MATH_LAPACK_CLAPACK_GESV_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
44#include <blaze/util/Complex.h>
46
47
48//=================================================================================================
49//
50// LAPACK FORWARD DECLARATIONS
51//
52//=================================================================================================
53
54//*************************************************************************************************
56#if !defined(INTEL_MKL_VERSION) && !defined(BLAS_H)
57extern "C" {
58
59void sgesv_( blaze::blas_int_t* n, blaze::blas_int_t* nrhs, float* A, blaze::blas_int_t* lda,
60 blaze::blas_int_t* ipiv, float* b, blaze::blas_int_t* ldb, blaze::blas_int_t* info );
61void dgesv_( blaze::blas_int_t* n, blaze::blas_int_t* nrhs, double* A, blaze::blas_int_t* lda,
62 blaze::blas_int_t* ipiv, double* b, blaze::blas_int_t* ldb, blaze::blas_int_t* info );
63void cgesv_( blaze::blas_int_t* n, blaze::blas_int_t* nrhs, float* A, blaze::blas_int_t* lda,
64 blaze::blas_int_t* ipiv, float* b, blaze::blas_int_t* ldb, blaze::blas_int_t* info );
65void zgesv_( blaze::blas_int_t* n, blaze::blas_int_t* nrhs, double* A, blaze::blas_int_t* lda,
66 blaze::blas_int_t* ipiv, double* b, blaze::blas_int_t* ldb, blaze::blas_int_t* info );
67
68}
69#endif
71//*************************************************************************************************
72
73
74
75
76namespace blaze {
77
78//=================================================================================================
79//
80// LAPACK GENERAL LINEAR SYSTEM FUNCTIONS (GESV)
81//
82//=================================================================================================
83
84//*************************************************************************************************
87void gesv( blas_int_t n, blas_int_t nrhs, float* A, blas_int_t lda,
88 blas_int_t* ipiv, float* B, blas_int_t ldb, blas_int_t* info );
89
90void gesv( blas_int_t n, blas_int_t nrhs, double* A, blas_int_t lda,
91 blas_int_t* ipiv, double* B, blas_int_t ldb, blas_int_t* info );
92
94 blas_int_t* ipiv, complex<float>* B, blas_int_t ldb, blas_int_t* info );
95
97 blas_int_t* ipiv, complex<double>* B, blas_int_t ldb, blas_int_t* info );
99//*************************************************************************************************
100
101
102//*************************************************************************************************
145inline void gesv( blas_int_t n, blas_int_t nrhs, float* A, blas_int_t lda,
146 blas_int_t* ipiv, float* B, blas_int_t ldb, blas_int_t* info )
147{
148#if defined(INTEL_MKL_VERSION)
149 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
150#endif
151
152 sgesv_( &n, &nrhs, A, &lda, ipiv, B, &ldb, info );
153}
154//*************************************************************************************************
155
156
157//*************************************************************************************************
200inline void gesv( blas_int_t n, blas_int_t nrhs, double* A, blas_int_t lda,
201 blas_int_t* ipiv, double* B, blas_int_t ldb, blas_int_t* info )
202{
203#if defined(INTEL_MKL_VERSION)
204 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
205#endif
206
207 dgesv_( &n, &nrhs, A, &lda, ipiv, B, &ldb, info );
208}
209//*************************************************************************************************
210
211
212//*************************************************************************************************
255inline void gesv( blas_int_t n, blas_int_t nrhs, complex<float>* A, blas_int_t lda,
256 blas_int_t* ipiv, complex<float>* B, blas_int_t ldb, blas_int_t* info )
257{
258 BLAZE_STATIC_ASSERT( sizeof( complex<float> ) == 2UL*sizeof( float ) );
259
260#if defined(INTEL_MKL_VERSION)
261 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
262 BLAZE_STATIC_ASSERT( sizeof( MKL_Complex8 ) == sizeof( complex<float> ) );
263 using ET = MKL_Complex8;
264#else
265 using ET = float;
266#endif
267
268 cgesv_( &n, &nrhs, reinterpret_cast<ET*>( A ), &lda, ipiv,
269 reinterpret_cast<ET*>( B ), &ldb, info );
270}
271//*************************************************************************************************
272
273
274//*************************************************************************************************
317inline void gesv( blas_int_t n, blas_int_t nrhs, complex<double>* A, blas_int_t lda,
318 blas_int_t* ipiv, complex<double>* B, blas_int_t ldb, blas_int_t* info )
319{
320 BLAZE_STATIC_ASSERT( sizeof( complex<double> ) == 2UL*sizeof( double ) );
321
322#if defined(INTEL_MKL_VERSION)
323 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
324 BLAZE_STATIC_ASSERT( sizeof( MKL_Complex16 ) == sizeof( complex<double> ) );
325 using ET = MKL_Complex16;
326#else
327 using ET = double;
328#endif
329
330 zgesv_( &n, &nrhs, reinterpret_cast<ET*>( A ), &lda, ipiv,
331 reinterpret_cast<ET*>( B ), &ldb, info );
332}
333//*************************************************************************************************
334
335} // namespace blaze
336
337#endif
Header file for the complex data type.
Compile time assertion.
Complex data type of the Blaze library.
void gesv(DenseMatrix< MT1, SO1 > &A, DenseMatrix< MT2, SO2 > &B, blas_int_t *ipiv)
LAPACK kernel for solving a general linear system of equations ( ).
Definition: gesv.h:239
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
Header file for basic BLAS type definitions.