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

◆ LAPACKE_cgesvdx()

lapack_int LAPACKE_cgesvdx ( int  matrix_layout,
char  jobu,
char  jobvt,
char  range,
lapack_int  m,
lapack_int  n,
lapack_complex_float a,
lapack_int  lda,
float  vl,
float  vu,
lapack_int  il,
lapack_int  iu,
lapack_int ns,
float *  s,
lapack_complex_float u,
lapack_int  ldu,
lapack_complex_float vt,
lapack_int  ldvt,
lapack_int superb 
)

Definition at line 35 of file lapacke_cgesvdx.c.

42{
43 lapack_int info = 0;
44 lapack_int lwork = -1;
45 lapack_complex_float* work = NULL;
46 lapack_complex_float work_query;
47 float* rwork = NULL;
48 lapack_int lrwork = MAX(1, MIN(m,n)*(MIN(m,n)*2+15*MIN(m,n)));
49 lapack_int* iwork = NULL;
50 lapack_int i;
51 if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
52 LAPACKE_xerbla( "LAPACKE_cgesvdx", -1 );
53 return -1;
54 }
55#ifndef LAPACK_DISABLE_NAN_CHECK
56 if( LAPACKE_get_nancheck() ) {
57 /* Optionally check input matrices for NaNs */
58 if( LAPACKE_cge_nancheck( matrix_layout, m, n, a, lda ) ) {
59 return -6;
60 }
61 }
62#endif
63 /* Query optimal working array(s) size */
64 info = LAPACKE_cgesvdx_work( matrix_layout, jobu, jobvt, range,
65 m, n, a, lda, vl, vu, il, iu, ns, s, u,
66 ldu, vt, ldvt, &work_query, lwork, rwork, iwork );
67 if( info != 0 ) {
68 goto exit_level_0;
69 }
70 lwork = LAPACK_C2INT (work_query);
71 /* Allocate memory for work arrays */
72 work = (lapack_complex_float*)
73 LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
74 if( work == NULL ) {
76 goto exit_level_1;
77 }
78 rwork = (float*)LAPACKE_malloc( sizeof(float) * lrwork );
79 if( rwork == NULL ) {
81 goto exit_level_0;
82 }
83 iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,(12*MIN(m,n))) );
84 if( iwork == NULL ) {
86 goto exit_level_2;
87 }
88 /* Call middle-level interface */
89 info = LAPACKE_cgesvdx_work( matrix_layout, jobu, jobvt, range,
90 m, n, a, lda, vl, vu, il, iu, ns, s, u,
91 ldu, vt, ldvt, work, lwork, rwork, iwork );
92 /* Backup significant data from working array(s) */
93 for( i=0; i<12*MIN(m,n)-1; i++ ) {
94 superb[i] = iwork[i+1];
95 }
96 /* Release memory and exit */
97 LAPACKE_free( iwork );
98exit_level_2:
99 LAPACKE_free( work );
100exit_level_1:
101 LAPACKE_free( rwork );
102exit_level_0:
103 if( info == LAPACK_WORK_MEMORY_ERROR ) {
104 LAPACKE_xerbla( "LAPACKE_cgesvdx", 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_cgesvdx_work(int matrix_layout, char jobu, char jobvt, char range, lapack_int m, lapack_int n, lapack_complex_float *a, lapack_int lda, float vl, float vu, lapack_int il, lapack_int iu, lapack_int *ns, 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
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: