LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dgees()

lapack_int LAPACKE_dgees ( int  matrix_layout,
char  jobvs,
char  sort,
LAPACK_D_SELECT2  select,
lapack_int  n,
double *  a,
lapack_int  lda,
lapack_int sdim,
double *  wr,
double *  wi,
double *  vs,
lapack_int  ldvs 
)

Definition at line 36 of file lapacke_dgees.c.

40 {
41  lapack_int info = 0;
42  lapack_int lwork = -1;
43  lapack_logical* bwork = NULL;
44  double* work = NULL;
45  double work_query;
46  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
47  LAPACKE_xerbla( "LAPACKE_dgees", -1 );
48  return -1;
49  }
50 #ifndef LAPACK_DISABLE_NAN_CHECK
51  if( LAPACKE_get_nancheck() ) {
52  /* Optionally check input matrices for NaNs */
53  if( LAPACKE_dge_nancheck( matrix_layout, n, n, a, lda ) ) {
54  return -6;
55  }
56  }
57 #endif
58  /* Allocate memory for working array(s) */
59  if( LAPACKE_lsame( sort, 's' ) ) {
60  bwork = (lapack_logical*)
61  LAPACKE_malloc( sizeof(lapack_logical) * MAX(1,n) );
62  if( bwork == NULL ) {
64  goto exit_level_0;
65  }
66  }
67  /* Query optimal working array(s) size */
68  info = LAPACKE_dgees_work( matrix_layout, jobvs, sort, select, n, a, lda,
69  sdim, wr, wi, vs, ldvs, &work_query, lwork,
70  bwork );
71  if( info != 0 ) {
72  goto exit_level_1;
73  }
74  lwork = (lapack_int)work_query;
75  /* Allocate memory for work arrays */
76  work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
77  if( work == NULL ) {
79  goto exit_level_1;
80  }
81  /* Call middle-level interface */
82  info = LAPACKE_dgees_work( matrix_layout, jobvs, sort, select, n, a, lda,
83  sdim, wr, wi, vs, ldvs, work, lwork, bwork );
84  /* Release memory and exit */
85  LAPACKE_free( work );
86 exit_level_1:
87  if( LAPACKE_lsame( sort, 's' ) ) {
88  LAPACKE_free( bwork );
89  }
90 exit_level_0:
91  if( info == LAPACK_WORK_MEMORY_ERROR ) {
92  LAPACKE_xerbla( "LAPACKE_dgees", info );
93  }
94  return info;
95 }
#define MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACK_COL_MAJOR
Definition: lapacke.h:120
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
lapack_logical LAPACKE_dge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const double *a, lapack_int lda)
int LAPACKE_get_nancheck()
#define lapack_int
Definition: lapacke.h:47
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:122
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:36
#define lapack_logical
Definition: lapacke.h:51
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
#define LAPACKE_free(p)
Definition: lapacke.h:113
lapack_int LAPACKE_dgees_work(int matrix_layout, char jobvs, char sort, LAPACK_D_SELECT2 select, lapack_int n, double *a, lapack_int lda, lapack_int *sdim, double *wr, double *wi, double *vs, lapack_int ldvs, double *work, lapack_int lwork, lapack_logical *bwork)
void LAPACKE_xerbla(const char *name, lapack_int info)
Here is the call graph for this function: