LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dgeevx()

lapack_int LAPACKE_dgeevx ( int  matrix_layout,
char  balanc,
char  jobvl,
char  jobvr,
char  sense,
lapack_int  n,
double *  a,
lapack_int  lda,
double *  wr,
double *  wi,
double *  vl,
lapack_int  ldvl,
double *  vr,
lapack_int  ldvr,
lapack_int ilo,
lapack_int ihi,
double *  scale,
double *  abnrm,
double *  rconde,
double *  rcondv 
)

Definition at line 36 of file lapacke_dgeevx.c.

42 {
43  lapack_int info = 0;
44  lapack_int lwork = -1;
45  lapack_int* iwork = NULL;
46  double* work = NULL;
47  double work_query;
48  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
49  LAPACKE_xerbla( "LAPACKE_dgeevx", -1 );
50  return -1;
51  }
52 #ifndef LAPACK_DISABLE_NAN_CHECK
53  if( LAPACKE_get_nancheck() ) {
54  /* Optionally check input matrices for NaNs */
55  if( LAPACKE_dge_nancheck( matrix_layout, n, n, a, lda ) ) {
56  return -7;
57  }
58  }
59 #endif
60  /* Allocate memory for working array(s) */
61  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'v' ) ) {
62  iwork = (lapack_int*)
63  LAPACKE_malloc( sizeof(lapack_int) * MAX(1,2*n-2) );
64  if( iwork == NULL ) {
66  goto exit_level_0;
67  }
68  }
69  /* Query optimal working array(s) size */
70  info = LAPACKE_dgeevx_work( matrix_layout, balanc, jobvl, jobvr, sense, n, a,
71  lda, wr, wi, vl, ldvl, vr, ldvr, ilo, ihi,
72  scale, abnrm, rconde, rcondv, &work_query,
73  lwork, iwork );
74  if( info != 0 ) {
75  goto exit_level_1;
76  }
77  lwork = (lapack_int)work_query;
78  /* Allocate memory for work arrays */
79  work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
80  if( work == NULL ) {
82  goto exit_level_1;
83  }
84  /* Call middle-level interface */
85  info = LAPACKE_dgeevx_work( matrix_layout, balanc, jobvl, jobvr, sense, n, a,
86  lda, wr, wi, vl, ldvl, vr, ldvr, ilo, ihi,
87  scale, abnrm, rconde, rcondv, work, lwork,
88  iwork );
89  /* Release memory and exit */
90  LAPACKE_free( work );
91 exit_level_1:
92  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'v' ) ) {
93  LAPACKE_free( iwork );
94  }
95 exit_level_0:
96  if( info == LAPACK_WORK_MEMORY_ERROR ) {
97  LAPACKE_xerbla( "LAPACKE_dgeevx", info );
98  }
99  return info;
100 }
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:122
#define LAPACKE_free(p)
Definition: lapacke.h:113
#define MAX(x, y)
Definition: lapacke_utils.h:47
lapack_logical LAPACKE_dge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const double *a, lapack_int lda)
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:36
#define LAPACK_COL_MAJOR
Definition: lapacke.h:120
void LAPACKE_xerbla(const char *name, lapack_int info)
#define lapack_int
Definition: lapacke.h:47
lapack_int LAPACKE_dgeevx_work(int matrix_layout, char balanc, char jobvl, char jobvr, char sense, lapack_int n, double *a, lapack_int lda, double *wr, double *wi, double *vl, lapack_int ldvl, double *vr, lapack_int ldvr, lapack_int *ilo, lapack_int *ihi, double *scale, double *abnrm, double *rconde, double *rcondv, double *work, lapack_int lwork, lapack_int *iwork)
int LAPACKE_get_nancheck()
Here is the call graph for this function: