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

◆ LAPACKE_dgesvdq()

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

Definition at line 35 of file lapacke_dgesvdq.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 lwork = -1;
46 double* work = NULL;
47 double work_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_dgesvdq", -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_dge_nancheck( matrix_layout, m, n, a, lda ) ) {
59 return -6;
60 }
61 }
62#endif
63 /* Query optimal working array(s) size */
64 info = LAPACKE_dgesvdq_work( matrix_layout, joba, jobp, jobr, jobu, jobv,
65 m, n, a, lda, s, u, ldu, v, ldv, numrank,
66 &iwork_query, liwork, &work_query, lwork,
67 &rwork_query, lrwork );
68 if( info != 0 ) {
69 goto exit_level_0;
70 }
71 liwork = iwork_query;
72 lwork = (lapack_int)work_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 }
80 work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
81 if( work == 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_dgesvdq_work( matrix_layout, joba, jobp, jobr, jobu, jobv,
92 m, n, a, lda, s, u, ldu, v, ldv, numrank,
93 iwork, liwork, work, lwork, rwork, lrwork );
94
95 /* Release memory and exit */
96 LAPACKE_free( iwork );
97 LAPACKE_free( work );
98 LAPACKE_free( rwork );
99exit_level_0:
100 if( info == LAPACK_WORK_MEMORY_ERROR ) {
101 LAPACKE_xerbla( "LAPACKE_dgesvdq", info );
102 }
103 return info;
104}
#define lapack_int
Definition: lapack.h:87
#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_dgesvdq_work(int matrix_layout, char joba, char jobp, char jobr, char jobu, char jobv, lapack_int m, lapack_int n, double *a, lapack_int lda, double *s, double *u, lapack_int ldu, double *v, lapack_int ldv, lapack_int *numrank, lapack_int *iwork, lapack_int liwork, double *work, lapack_int lwork, double *rwork, lapack_int lrwork)
#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_dge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const double *a, lapack_int lda)
Here is the call graph for this function: