LAPACK  3.10.1
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 35 of file lapacke_dgeevx.c.

41 {
42  lapack_int info = 0;
43  lapack_int lwork = -1;
44  lapack_int* iwork = NULL;
45  double* work = NULL;
46  double work_query;
47  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
48  LAPACKE_xerbla( "LAPACKE_dgeevx", -1 );
49  return -1;
50  }
51 #ifndef LAPACK_DISABLE_NAN_CHECK
52  if( LAPACKE_get_nancheck() ) {
53  /* Optionally check input matrices for NaNs */
54  if( LAPACKE_dge_nancheck( matrix_layout, n, n, a, lda ) ) {
55  return -7;
56  }
57  }
58 #endif
59  /* Allocate memory for working array(s) */
60  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'v' ) ) {
61  iwork = (lapack_int*)
62  LAPACKE_malloc( sizeof(lapack_int) * MAX(1,2*n-2) );
63  if( iwork == NULL ) {
65  goto exit_level_0;
66  }
67  }
68  /* Query optimal working array(s) size */
69  info = LAPACKE_dgeevx_work( matrix_layout, balanc, jobvl, jobvr, sense, n, a,
70  lda, wr, wi, vl, ldvl, vr, ldvr, ilo, ihi,
71  scale, abnrm, rconde, rcondv, &work_query,
72  lwork, iwork );
73  if( info != 0 ) {
74  goto exit_level_1;
75  }
76  lwork = (lapack_int)work_query;
77  /* Allocate memory for work arrays */
78  work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
79  if( work == NULL ) {
81  goto exit_level_1;
82  }
83  /* Call middle-level interface */
84  info = LAPACKE_dgeevx_work( matrix_layout, balanc, jobvl, jobvr, sense, n, a,
85  lda, wr, wi, vl, ldvl, vr, ldvr, ilo, ihi,
86  scale, abnrm, rconde, rcondv, work, lwork,
87  iwork );
88  /* Release memory and exit */
89  LAPACKE_free( work );
90 exit_level_1:
91  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'v' ) ) {
92  LAPACKE_free( iwork );
93  }
94 exit_level_0:
95  if( info == LAPACK_WORK_MEMORY_ERROR ) {
96  LAPACKE_xerbla( "LAPACKE_dgeevx", info );
97  }
98  return info;
99 }
#define lapack_int
Definition: lapack.h:83
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)
#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)
#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: