LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_zgges()

lapack_int LAPACKE_zgges ( int  matrix_layout,
char  jobvsl,
char  jobvsr,
char  sort,
LAPACK_Z_SELECT2  selctg,
lapack_int  n,
lapack_complex_double a,
lapack_int  lda,
lapack_complex_double b,
lapack_int  ldb,
lapack_int sdim,
lapack_complex_double alpha,
lapack_complex_double beta,
lapack_complex_double vsl,
lapack_int  ldvsl,
lapack_complex_double vsr,
lapack_int  ldvsr 
)

Definition at line 35 of file lapacke_zgges.c.

43 {
44  lapack_int info = 0;
45  lapack_int lwork = -1;
46  lapack_logical* bwork = NULL;
47  double* rwork = NULL;
48  lapack_complex_double* work = NULL;
49  lapack_complex_double work_query;
50  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
51  LAPACKE_xerbla( "LAPACKE_zgges", -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_zge_nancheck( matrix_layout, n, n, a, lda ) ) {
58  return -7;
59  }
60  if( LAPACKE_zge_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 = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,8*n) );
75  if( rwork == NULL ) {
77  goto exit_level_1;
78  }
79  /* Query optimal working array(s) size */
80  info = LAPACKE_zgges_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_Z2INT( work_query );
87  /* Allocate memory for work arrays */
88  work = (lapack_complex_double*)
89  LAPACKE_malloc( sizeof(lapack_complex_double) * lwork );
90  if( work == NULL ) {
92  goto exit_level_2;
93  }
94  /* Call middle-level interface */
95  info = LAPACKE_zgges_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 );
100 exit_level_2:
101  LAPACKE_free( rwork );
102 exit_level_1:
103  if( LAPACKE_lsame( sort, 's' ) ) {
104  LAPACKE_free( bwork );
105  }
106 exit_level_0:
107  if( info == LAPACK_WORK_MEMORY_ERROR ) {
108  LAPACKE_xerbla( "LAPACKE_zgges", info );
109  }
110  return info;
111 }
#define lapack_int
Definition: lapack.h:83
#define lapack_complex_double
Definition: lapack.h:63
#define lapack_logical
Definition: lapack.h:87
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:55
#define LAPACK_COL_MAJOR
Definition: lapacke.h:53
lapack_int LAPACKE_zgges_work(int matrix_layout, char jobvsl, char jobvsr, char sort, LAPACK_Z_SELECT2 selctg, lapack_int n, lapack_complex_double *a, lapack_int lda, lapack_complex_double *b, lapack_int ldb, lapack_int *sdim, lapack_complex_double *alpha, lapack_complex_double *beta, lapack_complex_double *vsl, lapack_int ldvsl, lapack_complex_double *vsr, lapack_int ldvsr, lapack_complex_double *work, lapack_int lwork, double *rwork, lapack_logical *bwork)
#define LAPACKE_free(p)
Definition: lapacke.h:46
#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
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
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 MAX(x, y)
Definition: lapacke_utils.h:46
Here is the call graph for this function: