LAPACK  3.10.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 35 of file lapacke_dgees.c.

39 {
40  lapack_int info = 0;
41  lapack_int lwork = -1;
42  lapack_logical* bwork = NULL;
43  double* work = NULL;
44  double work_query;
45  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
46  LAPACKE_xerbla( "LAPACKE_dgees", -1 );
47  return -1;
48  }
49 #ifndef LAPACK_DISABLE_NAN_CHECK
50  if( LAPACKE_get_nancheck() ) {
51  /* Optionally check input matrices for NaNs */
52  if( LAPACKE_dge_nancheck( matrix_layout, n, n, a, lda ) ) {
53  return -6;
54  }
55  }
56 #endif
57  /* Allocate memory for working array(s) */
58  if( LAPACKE_lsame( sort, 's' ) ) {
59  bwork = (lapack_logical*)
60  LAPACKE_malloc( sizeof(lapack_logical) * MAX(1,n) );
61  if( bwork == NULL ) {
63  goto exit_level_0;
64  }
65  }
66  /* Query optimal working array(s) size */
67  info = LAPACKE_dgees_work( matrix_layout, jobvs, sort, select, n, a, lda,
68  sdim, wr, wi, vs, ldvs, &work_query, lwork,
69  bwork );
70  if( info != 0 ) {
71  goto exit_level_1;
72  }
73  lwork = (lapack_int)work_query;
74  /* Allocate memory for work arrays */
75  work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
76  if( work == NULL ) {
78  goto exit_level_1;
79  }
80  /* Call middle-level interface */
81  info = LAPACKE_dgees_work( matrix_layout, jobvs, sort, select, n, a, lda,
82  sdim, wr, wi, vs, ldvs, work, lwork, bwork );
83  /* Release memory and exit */
84  LAPACKE_free( work );
85 exit_level_1:
86  if( LAPACKE_lsame( sort, 's' ) ) {
87  LAPACKE_free( bwork );
88  }
89 exit_level_0:
90  if( info == LAPACK_WORK_MEMORY_ERROR ) {
91  LAPACKE_xerbla( "LAPACKE_dgees", info );
92  }
93  return info;
94 }
#define lapack_int
Definition: lapack.h:83
#define lapack_logical
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
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:52
int LAPACKE_get_nancheck(void)
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)
#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)
#define MAX(x, y)
Definition: lapacke_utils.h:46
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: