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

◆ LAPACKE_zgesvdq()

lapack_int LAPACKE_zgesvdq ( int  matrix_layout,
char  joba,
char  jobp,
char  jobr,
char  jobu,
char  jobv,
lapack_int  m,
lapack_int  n,
lapack_complex_double a,
lapack_int  lda,
double *  s,
lapack_complex_double u,
lapack_int  ldu,
lapack_complex_double v,
lapack_int  ldv,
lapack_int numrank 
)

Definition at line 35 of file lapacke_zgesvdq.c.

40{
41 lapack_int info = 0;
42 lapack_int liwork = -1;
43 lapack_int* iwork = NULL;
44 lapack_int iwork_query;
45 lapack_int lcwork = -1;
46 lapack_complex_double* cwork = NULL;
47 lapack_complex_double cwork_query;
48 lapack_int lrwork = -1;
49 double* rwork = NULL;
50 double rwork_query;
51 if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
52 LAPACKE_xerbla( "LAPACKE_zgesvdq", -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_zgesvdq_work( matrix_layout, joba, jobp, jobr, jobu, jobv,
65 m, n, a, lda, s, u, ldu, v, ldv, numrank,
66 &iwork_query, liwork, &cwork_query, lcwork,
67 &rwork_query, lrwork );
68 if( info != 0 ) {
69 goto exit_level_0;
70 }
71 liwork = iwork_query;
72 lcwork = LAPACK_Z2INT(cwork_query);
73 lrwork = (lapack_int)rwork_query;
74 /* Allocate memory for work arrays */
75 iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
76 if( iwork == NULL ) {
78 goto exit_level_0;
79 }
81 if( cwork == NULL ) {
83 goto exit_level_0;
84 }
85 rwork = (double*)LAPACKE_malloc( sizeof(double) * lrwork );
86 if( rwork == NULL ) {
88 goto exit_level_0;
89 }
90 /* Call middle-level interface */
91 info = LAPACKE_zgesvdq_work( matrix_layout, joba, jobp, jobr, jobu, jobv,
92 m, n, a, lda, s, u, ldu, v, ldv, numrank,
93 iwork, liwork, cwork, lcwork, rwork, lrwork );
94
95 /* Release memory and exit */
96 LAPACKE_free( iwork );
97 LAPACKE_free( cwork );
98 LAPACKE_free( rwork );
99exit_level_0:
100 if( info == LAPACK_WORK_MEMORY_ERROR ) {
101 LAPACKE_xerbla( "LAPACKE_zgesvdq", info );
102 }
103 return info;
104}
#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
lapack_int LAPACKE_zgesvdq_work(int matrix_layout, char joba, char jobp, char jobr, char jobu, char jobv, lapack_int m, lapack_int n, lapack_complex_double *a, lapack_int lda, double *s, lapack_complex_double *u, lapack_int ldu, lapack_complex_double *v, lapack_int ldv, lapack_int *numrank, lapack_int *iwork, lapack_int liwork, lapack_complex_double *cwork, lapack_int lcwork, double *rwork, lapack_int lrwork)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:52
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)
Here is the call graph for this function: