Blaze 3.9
gesdd.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_LAPACK_CLAPACK_GESDD_H_
36#define _BLAZE_MATH_LAPACK_CLAPACK_GESDD_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)
58extern "C" {
59
60void sgesdd_( char* jobz, blaze::blas_int_t* m, blaze::blas_int_t* n, float* A,
61 blaze::blas_int_t* lda, float* s, float* U, blaze::blas_int_t* ldu,
62 float* V, blaze::blas_int_t* ldv, float* work, blaze::blas_int_t* lwork,
65void dgesdd_( char* jobz, blaze::blas_int_t* m, blaze::blas_int_t* n, double* A,
66 blaze::blas_int_t* lda, double* s, double* U, blaze::blas_int_t* ldu,
67 double* V, blaze::blas_int_t* ldv, double* work, blaze::blas_int_t* lwork,
70void cgesdd_( char* jobz, blaze::blas_int_t* m, blaze::blas_int_t* n, float* A,
71 blaze::blas_int_t* lda, float* s, float* U, blaze::blas_int_t* ldu,
72 float* V, blaze::blas_int_t* ldv, float* work, blaze::blas_int_t* lwork,
73 float* rwork, blaze::blas_int_t* iwork, blaze::blas_int_t* info,
75void zgesdd_( char* jobz, blaze::blas_int_t* m, blaze::blas_int_t* n, double* A,
76 blaze::blas_int_t* lda, double* s, double* U, blaze::blas_int_t* ldu,
77 double* V, blaze::blas_int_t* ldv, double* work, blaze::blas_int_t* lwork,
78 double* rwork, blaze::blas_int_t* iwork, blaze::blas_int_t* info,
80
81}
82#endif
84//*************************************************************************************************
85
86
87
88
89namespace blaze {
90
91//=================================================================================================
92//
93// LAPACK SVD FUNCTIONS (GESDD)
94//
95//=================================================================================================
96
97//*************************************************************************************************
100void gesdd( char jobz, blas_int_t m, blas_int_t n, float* A, blas_int_t lda,
101 float* s, float* U, blas_int_t ldu, float* V, blas_int_t ldv,
102 float* work, blas_int_t lwork, blas_int_t* iwork, blas_int_t* info );
103
104void gesdd( char jobz, blas_int_t m, blas_int_t n, double* A, blas_int_t lda,
105 double* s, double* U, blas_int_t ldu, double* V, blas_int_t ldv,
106 double* work, blas_int_t lwork, blas_int_t* iwork, blas_int_t* info );
107
108void gesdd( char jobz, blas_int_t m, blas_int_t n, complex<float>* A, blas_int_t lda,
109 float* s, complex<float>* U, blas_int_t ldu, complex<float>* V, blas_int_t ldv,
110 complex<float>* work, blas_int_t lwork, float* rwork, blas_int_t* iwork,
111 blas_int_t* info );
112
113void gesdd( char jobz, blas_int_t m, blas_int_t n, complex<double>* A, blas_int_t lda,
114 double* s, complex<double>* U, blas_int_t ldu, complex<double>* V, blas_int_t ldv,
115 complex<double>* work, blas_int_t lwork, double* rwork, blas_int_t* iwork,
116 blas_int_t* info );
118//*************************************************************************************************
119
120
121//*************************************************************************************************
185inline void gesdd( char jobz, blas_int_t m, blas_int_t n, float* A, blas_int_t lda,
186 float* s, float* U, blas_int_t ldu, float* V, blas_int_t ldv, float* work,
187 blas_int_t lwork, blas_int_t* iwork, 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 sgesdd_( &jobz, &m, &n, A, &lda, s, U, &ldu, V, &ldv, work, &lwork, iwork, info
194#if !defined(INTEL_MKL_VERSION)
196#endif
197 );
198}
199//*************************************************************************************************
200
201
202//*************************************************************************************************
266inline void gesdd( char jobz, blas_int_t m, blas_int_t n, double* A, blas_int_t lda,
267 double* s, double* U, blas_int_t ldu, double* V, blas_int_t ldv,
268 double* work, blas_int_t lwork, blas_int_t* iwork, blas_int_t* info )
269{
270#if defined(INTEL_MKL_VERSION)
271 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
272#endif
273
274 dgesdd_( &jobz, &m, &n, A, &lda, s, U, &ldu, V, &ldv, work, &lwork, iwork, info
275#if !defined(INTEL_MKL_VERSION)
277#endif
278 );
279}
280//*************************************************************************************************
281
282
283//*************************************************************************************************
348inline void gesdd( char jobz, blas_int_t m, blas_int_t n, complex<float>* A, blas_int_t lda,
349 float* s, complex<float>* U, blas_int_t ldu, complex<float>* V, blas_int_t ldv,
350 complex<float>* work, blas_int_t lwork, float* rwork, blas_int_t* iwork,
351 blas_int_t* info )
352{
353 BLAZE_STATIC_ASSERT( sizeof( complex<float> ) == 2UL*sizeof( float ) );
354
355#if defined(INTEL_MKL_VERSION)
356 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
357 BLAZE_STATIC_ASSERT( sizeof( MKL_Complex8 ) == sizeof( complex<float> ) );
358 using ET = MKL_Complex8;
359#else
360 using ET = float;
361#endif
362
363 cgesdd_( &jobz, &m, &n, reinterpret_cast<ET*>( A ), &lda, s,
364 reinterpret_cast<ET*>( U ), &ldu, reinterpret_cast<ET*>( V ), &ldv,
365 reinterpret_cast<ET*>( work ), &lwork, rwork, iwork, info
366#if !defined(INTEL_MKL_VERSION)
368#endif
369 );
370}
371//*************************************************************************************************
372
373
374//*************************************************************************************************
439inline void gesdd( char jobz, blas_int_t m, blas_int_t n, complex<double>* A, blas_int_t lda,
440 double* s, complex<double>* U, blas_int_t ldu, complex<double>* V, blas_int_t ldv,
441 complex<double>* work, blas_int_t lwork, double* rwork, blas_int_t* iwork,
442 blas_int_t* info )
443{
444 BLAZE_STATIC_ASSERT( sizeof( complex<double> ) == 2UL*sizeof( double ) );
445
446#if defined(INTEL_MKL_VERSION)
447 BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
448 BLAZE_STATIC_ASSERT( sizeof( MKL_Complex16 ) == sizeof( complex<double> ) );
449 using ET = MKL_Complex16;
450#else
451 using ET = double;
452#endif
453
454 zgesdd_( &jobz, &m, &n, reinterpret_cast<ET*>( A ), &lda, s,
455 reinterpret_cast<ET*>( U ), &ldu, reinterpret_cast<ET*>( V ), &ldv,
456 reinterpret_cast<ET*>( work ), &lwork, rwork, iwork, info
457#if !defined(INTEL_MKL_VERSION)
459#endif
460 );
461}
462//*************************************************************************************************
463
464} // namespace blaze
465
466#endif
Header file for the complex data type.
Compile time assertion.
Complex data type of the Blaze library.
void gesdd(DenseMatrix< MT1, SO > &A, DenseMatrix< MT2, SO > &U, DenseVector< VT, TF > &s, DenseMatrix< MT3, SO > &V, char jobz)
LAPACK kernel for the singular value decomposition (SVD) of the given dense general matrix.
Definition: gesdd.h:1089
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.