LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_cgesvdq()

lapack_int LAPACKE_cgesvdq ( int  matrix_layout,
char  joba,
char  jobp,
char  jobr,
char  jobu,
char  jobv,
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 v,
lapack_int  ldv,
lapack_int numrank 
)

Definition at line 35 of file lapacke_cgesvdq.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_float* cwork = NULL;
47  lapack_complex_float cwork_query;
48  lapack_int lrwork = -1;
49  float* rwork = NULL;
50  float rwork_query;
51  lapack_int i;
52  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
53  LAPACKE_xerbla( "LAPACKE_cgesvdq", -1 );
54  return -1;
55  }
56 #ifndef LAPACK_DISABLE_NAN_CHECK
57  if( LAPACKE_get_nancheck() ) {
58  /* Optionally check input matrices for NaNs */
59  if( LAPACKE_cge_nancheck( matrix_layout, m, n, a, lda ) ) {
60  return -6;
61  }
62  }
63 #endif
64  /* Query optimal working array(s) size */
65  info = LAPACKE_cgesvdq_work( matrix_layout, joba, jobp, jobr, jobu, jobv,
66  m, n, a, lda, s, u, ldu, v, ldv, numrank,
67  &iwork_query, liwork, &cwork_query, lcwork,
68  &rwork_query, lrwork );
69  if( info != 0 ) {
70  goto exit_level_0;
71  }
72  liwork = iwork_query;
73  lcwork = LAPACK_C2INT(cwork_query);
74  lrwork = (lapack_int)rwork_query;
75  /* Allocate memory for work arrays */
76  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
77  if( iwork == NULL ) {
79  goto exit_level_0;
80  }
81  cwork = (lapack_complex_float*)LAPACKE_malloc( sizeof(lapack_complex_float) * lcwork );
82  if( cwork == NULL ) {
84  goto exit_level_0;
85  }
86  rwork = (float*)LAPACKE_malloc( sizeof(float) * lrwork );
87  if( rwork == NULL ) {
89  goto exit_level_0;
90  }
91  /* Call middle-level interface */
92  info = LAPACKE_cgesvdq_work( matrix_layout, joba, jobp, jobr, jobu, jobv,
93  m, n, a, lda, s, u, ldu, v, ldv, numrank,
94  iwork, liwork, cwork, lcwork, rwork, lrwork );
95 
96  /* Release memory and exit */
97  LAPACKE_free( iwork );
98  LAPACKE_free( cwork );
99  LAPACKE_free( rwork );
100 exit_level_0:
101  if( info == LAPACK_WORK_MEMORY_ERROR ) {
102  LAPACKE_xerbla( "LAPACKE_cgesvdq", info );
103  }
104  return info;
105 }
#define lapack_int
Definition: lapack.h:83
#define lapack_complex_float
Definition: lapack.h:45
#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
lapack_int LAPACKE_cgesvdq_work(int matrix_layout, char joba, char jobp, char jobr, char jobu, char jobv, 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 *v, lapack_int ldv, lapack_int *numrank, lapack_int *iwork, lapack_int liwork, lapack_complex_float *cwork, lapack_int lcwork, float *rwork, lapack_int lrwork)
#define LAPACKE_free(p)
Definition: lapacke.h:46
#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)
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: