Blaze 3.9
getri.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_LAPACK_CLAPACK_GETRI_H_
36#define _BLAZE_MATH_LAPACK_CLAPACK_GETRI_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)
57extern "C" {
58
59void sgetri_( blaze::blas_int_t* n, float* A, blaze::blas_int_t* lda, blaze::blas_int_t* ipiv,
60 float* work, blaze::blas_int_t* lwork, blaze::blas_int_t* info );
61void dgetri_( blaze::blas_int_t* n, double* A, blaze::blas_int_t* lda, blaze::blas_int_t* ipiv,
62 double* work, blaze::blas_int_t* lwork, blaze::blas_int_t* info );
63void cgetri_( blaze::blas_int_t* n, float* A, blaze::blas_int_t* lda, blaze::blas_int_t* ipiv,
64 float* work, blaze::blas_int_t* lwork, blaze::blas_int_t* info );
65void zgetri_( blaze::blas_int_t* n, double* A, blaze::blas_int_t* lda, blaze::blas_int_t* ipiv,
66 double* work, blaze::blas_int_t* lwork, blaze::blas_int_t* info );
67
68}
69#endif
71//*************************************************************************************************
72
73
74
75
76namespace blaze {
77
78//=================================================================================================
79//
80// LAPACK LU-BASED INVERSION FUNCTIONS (GETRI)
81//
82//=================================================================================================
83
84//*************************************************************************************************
87void getri( blas_int_t n, float* A, blas_int_t lda, const blas_int_t* ipiv,
88 float* work, blas_int_t lwork, blas_int_t* info );
89
90void getri( blas_int_t n, double* A, blas_int_t lda, const blas_int_t* ipiv,
91 double* work, blas_int_t lwork, blas_int_t* info );
92
93void getri( blas_int_t n, complex<float>* A, blas_int_t lda, const blas_int_t* ipiv,
94 complex<float>* work, blas_int_t lwork, blas_int_t* info );
95
96void getri( blas_int_t n, complex<double>* A, blas_int_t lda, const blas_int_t* ipiv,
97 complex<double>* work, blas_int_t lwork, blas_int_t* info );
99//*************************************************************************************************
100
101
102//*************************************************************************************************
138inline void getri( blas_int_t n, float* A, blas_int_t lda, const blas_int_t* ipiv,
139 float* work, blas_int_t lwork, blas_int_t* info )
140{
141#if defined(INTEL_MKL_VERSION)
142 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
143#endif
144
145 sgetri_( &n, A, &lda, const_cast<blas_int_t*>( ipiv ), work, &lwork, info );
146}
147//*************************************************************************************************
148
149
150//*************************************************************************************************
186inline void getri( blas_int_t n, double* A, blas_int_t lda, const blas_int_t* ipiv,
187 double* work, blas_int_t lwork, blas_int_t* info )
188{
189#if defined(INTEL_MKL_VERSION)
190 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
191#endif
192
193 dgetri_( &n, A, &lda, const_cast<blas_int_t*>( ipiv ), work, &lwork, info );
194}
195//*************************************************************************************************
196
197
198//*************************************************************************************************
234inline void getri( blas_int_t n, complex<float>* A, blas_int_t lda, const blas_int_t* ipiv,
235 complex<float>* work, blas_int_t lwork, blas_int_t* info )
236{
237 BLAZE_STATIC_ASSERT( sizeof( complex<float> ) == 2UL*sizeof( float ) );
238
239#if defined(INTEL_MKL_VERSION)
240 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
241 BLAZE_STATIC_ASSERT( sizeof( MKL_Complex8 ) == sizeof( complex<float> ) );
242 using ET = MKL_Complex8;
243#else
244 using ET = float;
245#endif
246
247 cgetri_( &n, reinterpret_cast<ET*>( A ), &lda, const_cast<blas_int_t*>( ipiv ),
248 reinterpret_cast<ET*>( work ), &lwork, info );
249}
250//*************************************************************************************************
251
252
253//*************************************************************************************************
289inline void getri( blas_int_t n, complex<double>* A, blas_int_t lda, const blas_int_t* ipiv,
290 complex<double>* work, blas_int_t lwork, blas_int_t* info )
291{
292 BLAZE_STATIC_ASSERT( sizeof( complex<double> ) == 2UL*sizeof( double ) );
293
294#if defined(INTEL_MKL_VERSION)
295 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
296 BLAZE_STATIC_ASSERT( sizeof( MKL_Complex16 ) == sizeof( complex<double> ) );
297 using ET = MKL_Complex16;
298#else
299 using ET = double;
300#endif
301
302 zgetri_( &n, reinterpret_cast<ET*>( A ), &lda, const_cast<blas_int_t*>( ipiv ),
303 reinterpret_cast<ET*>( work ), &lwork, info );
304}
305//*************************************************************************************************
306
307} // namespace blaze
308
309#endif
Header file for the complex data type.
Compile time assertion.
Complex data type of the Blaze library.
void getri(DenseMatrix< MT, SO > &A, const blas_int_t *ipiv)
LAPACK kernel for the inversion of the given dense general matrix.
Definition: getri.h:111
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.