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

◆ LAPACKE_cgges3()

lapack_int LAPACKE_cgges3 ( int  matrix_layout,
char  jobvsl,
char  jobvsr,
char  sort,
LAPACK_C_SELECT2  selctg,
lapack_int  n,
lapack_complex_float a,
lapack_int  lda,
lapack_complex_float b,
lapack_int  ldb,
lapack_int sdim,
lapack_complex_float alpha,
lapack_complex_float beta,
lapack_complex_float vsl,
lapack_int  ldvsl,
lapack_complex_float vsr,
lapack_int  ldvsr 
)

Definition at line 35 of file lapacke_cgges3.c.

43{
44 lapack_int info = 0;
45 lapack_int lwork = -1;
46 lapack_logical* bwork = NULL;
47 float* rwork = NULL;
48 lapack_complex_float* work = NULL;
49 lapack_complex_float work_query;
50 if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
51 LAPACKE_xerbla( "LAPACKE_cgges3", -1 );
52 return -1;
53 }
54#ifndef LAPACK_DISABLE_NAN_CHECK
55 if( LAPACKE_get_nancheck() ) {
56 /* Optionally check input matrices for NaNs */
57 if( LAPACKE_cge_nancheck( matrix_layout, n, n, a, lda ) ) {
58 return -7;
59 }
60 if( LAPACKE_cge_nancheck( matrix_layout, n, n, b, ldb ) ) {
61 return -9;
62 }
63 }
64#endif
65 /* Allocate memory for working array(s) */
66 if( LAPACKE_lsame( sort, 's' ) ) {
67 bwork = (lapack_logical*)
68 LAPACKE_malloc( sizeof(lapack_logical) * MAX(1,n) );
69 if( bwork == NULL ) {
71 goto exit_level_0;
72 }
73 }
74 rwork = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,8*n) );
75 if( rwork == NULL ) {
77 goto exit_level_1;
78 }
79 /* Query optimal working array(s) size */
80 info = LAPACKE_cgges3_work( matrix_layout, jobvsl, jobvsr, sort, selctg, n, a,
81 lda, b, ldb, sdim, alpha, beta, vsl, ldvsl, vsr,
82 ldvsr, &work_query, lwork, rwork, bwork );
83 if( info != 0 ) {
84 goto exit_level_2;
85 }
86 lwork = LAPACK_C2INT( work_query );
87 /* Allocate memory for work arrays */
88 work = (lapack_complex_float*)
89 LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
90 if( work == NULL ) {
92 goto exit_level_2;
93 }
94 /* Call middle-level interface */
95 info = LAPACKE_cgges3_work( matrix_layout, jobvsl, jobvsr, sort, selctg, n, a,
96 lda, b, ldb, sdim, alpha, beta, vsl, ldvsl, vsr,
97 ldvsr, work, lwork, rwork, bwork );
98 /* Release memory and exit */
99 LAPACKE_free( work );
100exit_level_2:
101 LAPACKE_free( rwork );
102exit_level_1:
103 if( LAPACKE_lsame( sort, 's' ) ) {
104 LAPACKE_free( bwork );
105 }
106exit_level_0:
107 if( info == LAPACK_WORK_MEMORY_ERROR ) {
108 LAPACKE_xerbla( "LAPACKE_cgges3", info );
109 }
110 return info;
111}
#define lapack_int
Definition: lapack.h:87
#define lapack_complex_float
Definition: lapack.h:46
#define lapack_logical
Definition: lapack.h:103
#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
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:52
int LAPACKE_get_nancheck(void)
#define LAPACKE_malloc(size)
Definition: lapacke.h:43
lapack_int LAPACKE_cgges3_work(int matrix_layout, char jobvsl, char jobvsr, char sort, LAPACK_C_SELECT2 selctg, lapack_int n, lapack_complex_float *a, lapack_int lda, lapack_complex_float *b, lapack_int ldb, lapack_int *sdim, lapack_complex_float *alpha, lapack_complex_float *beta, lapack_complex_float *vsl, lapack_int ldvsl, lapack_complex_float *vsr, lapack_int ldvsr, lapack_complex_float *work, lapack_int lwork, float *rwork, lapack_logical *bwork)
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
void LAPACKE_xerbla(const char *name, lapack_int info)
#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: