LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ LAPACKE_cgesdd()

lapack_int LAPACKE_cgesdd ( int  matrix_layout,
char  jobz,
lapack_int  m,
lapack_int  n,
lapack_complex_float a,
lapack_int  lda,
float *  s,
lapack_complex_float u,
lapack_int  ldu,
lapack_complex_float vt,
lapack_int  ldvt 
)

Definition at line 35 of file lapacke_cgesdd.c.

40{
41 lapack_int info = 0;
42 lapack_int lwork = -1;
43 /* Additional scalars declarations for work arrays */
44 size_t lrwork;
45 lapack_int* iwork = NULL;
46 float* rwork = NULL;
47 lapack_complex_float* work = NULL;
48 lapack_complex_float work_query;
49 if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
50 LAPACKE_xerbla( "LAPACKE_cgesdd", -1 );
51 return -1;
52 }
53#ifndef LAPACK_DISABLE_NAN_CHECK
54 if( LAPACKE_get_nancheck() ) {
55 /* Optionally check input matrices for NaNs */
56 if( LAPACKE_cge_nancheck( matrix_layout, m, n, a, lda ) ) {
57 return -5;
58 }
59 }
60#endif
61 /* Additional scalars initializations for work arrays */
62 if( LAPACKE_lsame( jobz, 'n' ) ) {
63 lrwork = MAX(1,7*MIN(m,n));
64 } else {
65 lrwork = (size_t)MAX(1,MIN(m,n)*MAX(5*MIN(m,n)+7,2*MAX(m,n)+2*MIN(m,n)+1));
66 }
67 /* Allocate memory for working array(s) */
68 iwork = (lapack_int*)
69 LAPACKE_malloc( sizeof(lapack_int) * MAX(1,8*MIN(m,n)) );
70 if( iwork == NULL ) {
72 goto exit_level_0;
73 }
74 rwork = (float*)LAPACKE_malloc( sizeof(float) * lrwork );
75 if( rwork == NULL ) {
77 goto exit_level_1;
78 }
79 /* Query optimal working array(s) size */
80 info = LAPACKE_cgesdd_work( matrix_layout, jobz, m, n, a, lda, s, u, ldu, vt,
81 ldvt, &work_query, lwork, rwork, iwork );
82 if( info != 0 ) {
83 goto exit_level_2;
84 }
85 lwork = LAPACK_C2INT( work_query );
86 /* Allocate memory for work arrays */
87 work = (lapack_complex_float*)
88 LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
89 if( work == NULL ) {
91 goto exit_level_2;
92 }
93 /* Call middle-level interface */
94 info = LAPACKE_cgesdd_work( matrix_layout, jobz, m, n, a, lda, s, u, ldu, vt,
95 ldvt, work, lwork, rwork, iwork );
96 /* Release memory and exit */
97 LAPACKE_free( work );
98exit_level_2:
99 LAPACKE_free( rwork );
100exit_level_1:
101 LAPACKE_free( iwork );
102exit_level_0:
103 if( info == LAPACK_WORK_MEMORY_ERROR ) {
104 LAPACKE_xerbla( "LAPACKE_cgesdd", info );
105 }
106 return info;
107}
#define lapack_int
Definition: lapack.h:87
#define lapack_complex_float
Definition: lapack.h:46
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:55
#define LAPACK_COL_MAJOR
Definition: lapacke.h:53
#define LAPACK_C2INT(x)
Definition: lapacke.h:49
#define LAPACKE_free(p)
Definition: lapacke.h:46
lapack_int LAPACKE_cgesdd_work(int matrix_layout, char jobz, lapack_int m, lapack_int n, lapack_complex_float *a, lapack_int lda, float *s, lapack_complex_float *u, lapack_int ldu, lapack_complex_float *vt, lapack_int ldvt, lapack_complex_float *work, lapack_int lwork, float *rwork, lapack_int *iwork)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:52
int LAPACKE_get_nancheck(void)
#define LAPACKE_malloc(size)
Definition: lapacke.h:43
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
void LAPACKE_xerbla(const char *name, lapack_int info)
#define MIN(x, y)
Definition: lapacke_utils.h:49
#define MAX(x, y)
Definition: lapacke_utils.h:46
lapack_logical LAPACKE_cge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_float *a, lapack_int lda)
Here is the call graph for this function: