Blaze 3.9
gesvdx.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_LAPACK_CLAPACK_GESVDX_H_
36#define _BLAZE_MATH_LAPACK_CLAPACK_GESVDX_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) || (INTEL_MKL_VERSION < 20170000)
58extern "C" {
59
60void sgesvdx_( char* jobu, char* jobv, char* range, blaze::blas_int_t* m, blaze::blas_int_t* n,
61 float* A, blaze::blas_int_t* lda, float* vl, float* vu, blaze::blas_int_t* il,
62 blaze::blas_int_t* iu, blaze::blas_int_t* ns, float* s, float* U,
63 blaze::blas_int_t* ldu, float* V, blaze::blas_int_t* ldv, float* work,
67void dgesvdx_( char* jobu, char* jobv, char* range, blaze::blas_int_t* m, blaze::blas_int_t* n,
68 double* A, blaze::blas_int_t* lda, double* vl, double* vu, blaze::blas_int_t* il,
69 blaze::blas_int_t* iu, blaze::blas_int_t* ns, double* s, double* U,
70 blaze::blas_int_t* ldu, double* V, blaze::blas_int_t* ldv, double* work,
74void cgesvdx_( char* jobu, char* jobv, char* range, blaze::blas_int_t* m, blaze::blas_int_t* n,
75 float* A, blaze::blas_int_t* lda, float* vl, float* vu, blaze::blas_int_t* il,
76 blaze::blas_int_t* iu, blaze::blas_int_t* ns, float* s, float* U,
77 blaze::blas_int_t* ldu, float* V, blaze::blas_int_t* ldv, float* work,
78 blaze::blas_int_t* lwork, float* rwork, blaze::blas_int_t* iwork,
81void zgesvdx_( char* jobu, char* jobv, char* range, blaze::blas_int_t* m, blaze::blas_int_t* n,
82 double* A, blaze::blas_int_t* lda, double* vl, double* vu, blaze::blas_int_t* il,
83 blaze::blas_int_t* iu, blaze::blas_int_t* ns, double* s, double* U,
84 blaze::blas_int_t* ldu, double* V, blaze::blas_int_t* ldv, double* work,
85 blaze::blas_int_t* lwork, double* rwork, blaze::blas_int_t* iwork,
88
89}
90#endif
92//*************************************************************************************************
93
94
95
96
97namespace blaze {
98
99//=================================================================================================
100//
101// LAPACK SVD FUNCTIONS (GESVDX)
102//
103//=================================================================================================
104
105//*************************************************************************************************
108void gesvdx( char jobu, char jobv, char range, blas_int_t m, blas_int_t n,
109 float* A, blas_int_t lda, float vl, float vu,
110 blas_int_t il, blas_int_t iu, blas_int_t* ns, float* s,
111 float* U, blas_int_t ldu, float* V, blas_int_t ldv,
112 float* work, blas_int_t lwork, blas_int_t* iwork,
113 blas_int_t* info );
114
115void gesvdx( char jobu, char jobv, char range, blas_int_t m, blas_int_t n,
116 double* A, blas_int_t lda, double vl, double vu,
117 blas_int_t il, blas_int_t iu, blas_int_t* ns, double* s,
118 double* U, blas_int_t ldu, double* V, blas_int_t ldv,
119 double* work, blas_int_t lwork, blas_int_t* iwork,
120 blas_int_t* info );
121
122void gesvdx( char jobu, char jobv, char range, blas_int_t m, blas_int_t n,
123 complex<float>* A, blas_int_t lda, float vl, float vu,
124 blas_int_t il, blas_int_t iu, blas_int_t* ns, float* s,
126 complex<float>* work, blas_int_t lwork, float* rwork,
127 blas_int_t* iwork, blas_int_t* info );
128
129void gesvdx( char jobu, char jobv, char range, blas_int_t m, blas_int_t n,
130 complex<double>* A, blas_int_t lda, double vl, double vu,
131 blas_int_t il, blas_int_t iu, blas_int_t* ns, double* s,
133 complex<double>* work, blas_int_t lwork, double* rwork,
134 blas_int_t* iwork, blas_int_t* info );
136//*************************************************************************************************
137
138
139//*************************************************************************************************
213inline void gesvdx( char jobu, char jobv, char range, blas_int_t m, blas_int_t n,
214 float* A, blas_int_t lda, float vl, float vu,
215 blas_int_t il, blas_int_t iu, blas_int_t* ns, float* s,
216 float* U, blas_int_t ldu, float* V, blas_int_t ldv,
217 float* work, blas_int_t lwork, blas_int_t* iwork,
218 blas_int_t* info )
219{
220#if defined(INTEL_MKL_VERSION) && (INTEL_MKL_VERSION >= 20170000)
221 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
222#endif
223
224 ++il;
225 ++iu;
226
227 sgesvdx_( &jobu, &jobv, &range, &m, &n, A, &lda, &vl, &vu, &il, &iu, ns,
228 s, U, &ldu, V, &ldv, work, &lwork, iwork, info
229#if !defined(INTEL_MKL_VERSION) || (INTEL_MKL_VERSION < 20170000)
231#endif
232 );
233}
234//*************************************************************************************************
235
236
237//*************************************************************************************************
311inline void gesvdx( char jobu, char jobv, char range, blas_int_t m, blas_int_t n,
312 double* A, blas_int_t lda, double vl, double vu,
313 blas_int_t il, blas_int_t iu, blas_int_t* ns, double* s,
314 double* U, blas_int_t ldu, double* V, blas_int_t ldv,
315 double* work, blas_int_t lwork, blas_int_t* iwork,
316 blas_int_t* info )
317{
318#if defined(INTEL_MKL_VERSION) && (INTEL_MKL_VERSION >= 20170000)
319 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
320#endif
321
322 ++il;
323 ++iu;
324
325 dgesvdx_( &jobu, &jobv, &range, &m, &n, A, &lda, &vl, &vu, &il, &iu, ns,
326 s, U, &ldu, V, &ldv, work, &lwork, iwork, info
327#if !defined(INTEL_MKL_VERSION) || (INTEL_MKL_VERSION < 20170000)
329#endif
330 );
331}
332//*************************************************************************************************
333
334
335//*************************************************************************************************
410inline void gesvdx( char jobu, char jobv, char range, blas_int_t m, blas_int_t n,
411 complex<float>* A, blas_int_t lda, float vl, float vu,
412 blas_int_t il, blas_int_t iu, blas_int_t* ns, float* s,
413 complex<float>* U, blas_int_t ldu, complex<float>* V, blas_int_t ldv,
414 complex<float>* work, blas_int_t lwork, float* rwork,
415 blas_int_t* iwork, blas_int_t* info )
416{
417 BLAZE_STATIC_ASSERT( sizeof( complex<float> ) == 2UL*sizeof( float ) );
418
419#if defined(INTEL_MKL_VERSION) && (INTEL_MKL_VERSION >= 20170000)
420 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
421 BLAZE_STATIC_ASSERT( sizeof( MKL_Complex8 ) == sizeof( complex<float> ) );
422 using ET = MKL_Complex8;
423#else
424 using ET = float;
425#endif
426
427 ++il;
428 ++iu;
429
430 cgesvdx_( &jobu, &jobv, &range, &m, &n, reinterpret_cast<ET*>( A ), &lda,
431 &vl, &vu, &il, &iu, ns, s,
432 reinterpret_cast<ET*>( U ), &ldu, reinterpret_cast<ET*>( V ), &ldv,
433 reinterpret_cast<ET*>( work ), &lwork, rwork, iwork, info
434#if !defined(INTEL_MKL_VERSION) || (INTEL_MKL_VERSION < 20170000)
436#endif
437 );
438}
439//*************************************************************************************************
440
441
442//*************************************************************************************************
517inline void gesvdx( char jobu, char jobv, char range, blas_int_t m, blas_int_t n,
518 complex<double>* A, blas_int_t lda, double vl, double vu,
519 blas_int_t il, blas_int_t iu, blas_int_t* ns, double* s,
520 complex<double>* U, blas_int_t ldu, complex<double>* V, blas_int_t ldv,
521 complex<double>* work, blas_int_t lwork, double* rwork,
522 blas_int_t* iwork, blas_int_t* info )
523{
524 BLAZE_STATIC_ASSERT( sizeof( complex<double> ) == 2UL*sizeof( double ) );
525
526#if defined(INTEL_MKL_VERSION) && (INTEL_MKL_VERSION >= 20170000)
527 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
528 BLAZE_STATIC_ASSERT( sizeof( MKL_Complex16 ) == sizeof( complex<double> ) );
529 using ET = MKL_Complex16;
530#else
531 using ET = double;
532#endif
533
534 ++il;
535 ++iu;
536
537 zgesvdx_( &jobu, &jobv, &range, &m, &n, reinterpret_cast<ET*>( A ), &lda,
538 &vl, &vu, &il, &iu, ns, s,
539 reinterpret_cast<ET*>( U ), &ldu, reinterpret_cast<ET*>( V ), &ldv,
540 reinterpret_cast<ET*>( work ), &lwork, rwork, iwork, info
541#if !defined(INTEL_MKL_VERSION) || (INTEL_MKL_VERSION < 20170000)
543#endif
544 );
545}
546//*************************************************************************************************
547
548} // namespace blaze
549
550#endif
Header file for the complex data type.
Compile time assertion.
Complex data type of the Blaze library.
size_t gesvdx(DenseMatrix< MT1, SO > &A, DenseMatrix< MT2, SO > &U, DenseVector< VT, TF > &s, DenseMatrix< MT3, SO > &V, ST low, ST upp)
LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.
Definition: gesvdx.h:2031
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.