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

◆ LAPACKE_zgesvdx()

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

Definition at line 35 of file lapacke_zgesvdx.c.

42{
43 lapack_int info = 0;
44 lapack_int lwork = -1;
45 lapack_complex_double* work = NULL;
46 lapack_complex_double work_query;
47 double* 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_zgesvdx", -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_zge_nancheck( matrix_layout, m, n, a, lda ) ) {
59 return -6;
60 }
61 }
62#endif
63 /* Query optimal working array(s) size */
64 info = LAPACKE_zgesvdx_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_Z2INT (work_query);
71 /* Allocate memory for work arrays */
72 work = (lapack_complex_double*)
73 LAPACKE_malloc( sizeof(lapack_complex_double) * lwork );
74 if( work == NULL ) {
76 goto exit_level_1;
77 }
78 rwork = (double*)LAPACKE_malloc( sizeof(double) * 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_zgesvdx_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_zgesvdx", info );
105 }
106 return info;
107}
#define lapack_int
Definition: lapack.h:87
#define lapack_complex_double
Definition: lapack.h:64
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:55
#define LAPACK_COL_MAJOR
Definition: lapacke.h:53
#define LAPACKE_free(p)
Definition: lapacke.h:46
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:52
lapack_int LAPACKE_zgesvdx_work(int matrix_layout, char jobu, char jobvt, char range, lapack_int m, lapack_int n, lapack_complex_double *a, lapack_int lda, double vl, double vu, lapack_int il, lapack_int iu, lapack_int *ns, double *s, lapack_complex_double *u, lapack_int ldu, lapack_complex_double *vt, lapack_int ldvt, lapack_complex_double *work, lapack_int lwork, double *rwork, lapack_int *iwork)
int LAPACKE_get_nancheck(void)
#define LAPACK_Z2INT(x)
Definition: lapacke.h:50
#define LAPACKE_malloc(size)
Definition: lapacke.h:43
void LAPACKE_xerbla(const char *name, lapack_int info)
lapack_logical LAPACKE_zge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_double *a, lapack_int lda)
#define MIN(x, y)
Definition: lapacke_utils.h:49
#define MAX(x, y)
Definition: lapacke_utils.h:46
Here is the call graph for this function: