LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_dggevx ( int  matrix_layout,
char  balanc,
char  jobvl,
char  jobvr,
char  sense,
lapack_int  n,
double *  a,
lapack_int  lda,
double *  b,
lapack_int  ldb,
double *  alphar,
double *  alphai,
double *  beta,
double *  vl,
lapack_int  ldvl,
double *  vr,
lapack_int  ldvr,
lapack_int ilo,
lapack_int ihi,
double *  lscale,
double *  rscale,
double *  abnrm,
double *  bbnrm,
double *  rconde,
double *  rcondv 
)

Definition at line 36 of file lapacke_dggevx.c.

44 {
45  lapack_int info = 0;
46  lapack_int lwork = -1;
47  lapack_logical* bwork = NULL;
48  lapack_int* iwork = NULL;
49  double* work = NULL;
50  double work_query;
51  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
52  LAPACKE_xerbla( "LAPACKE_dggevx", -1 );
53  return -1;
54  }
55 #ifndef LAPACK_DISABLE_NAN_CHECK
56  /* Optionally check input matrices for NaNs */
57  if( LAPACKE_dge_nancheck( matrix_layout, n, n, a, lda ) ) {
58  return -7;
59  }
60  if( LAPACKE_dge_nancheck( matrix_layout, n, n, b, ldb ) ) {
61  return -9;
62  }
63 #endif
64  /* Allocate memory for working array(s) */
65  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'e' ) ||
66  LAPACKE_lsame( sense, 'v' ) ) {
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  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'n' ) ||
75  LAPACKE_lsame( sense, 'v' ) ) {
76  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,n+6) );
77  if( iwork == NULL ) {
79  goto exit_level_1;
80  }
81  }
82  /* Query optimal working array(s) size */
83  info = LAPACKE_dggevx_work( matrix_layout, balanc, jobvl, jobvr, sense, n, a,
84  lda, b, ldb, alphar, alphai, beta, vl, ldvl, vr,
85  ldvr, ilo, ihi, lscale, rscale, abnrm, bbnrm,
86  rconde, rcondv, &work_query, lwork, iwork,
87  bwork );
88  if( info != 0 ) {
89  goto exit_level_2;
90  }
91  lwork = (lapack_int)work_query;
92  /* Allocate memory for work arrays */
93  work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
94  if( work == NULL ) {
96  goto exit_level_2;
97  }
98  /* Call middle-level interface */
99  info = LAPACKE_dggevx_work( matrix_layout, balanc, jobvl, jobvr, sense, n, a,
100  lda, b, ldb, alphar, alphai, beta, vl, ldvl, vr,
101  ldvr, ilo, ihi, lscale, rscale, abnrm, bbnrm,
102  rconde, rcondv, work, lwork, iwork, bwork );
103  /* Release memory and exit */
104  LAPACKE_free( work );
105 exit_level_2:
106  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'n' ) ||
107  LAPACKE_lsame( sense, 'v' ) ) {
108  LAPACKE_free( iwork );
109  }
110 exit_level_1:
111  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'e' ) ||
112  LAPACKE_lsame( sense, 'v' ) ) {
113  LAPACKE_free( bwork );
114  }
115 exit_level_0:
116  if( info == LAPACK_WORK_MEMORY_ERROR ) {
117  LAPACKE_xerbla( "LAPACKE_dggevx", info );
118  }
119  return info;
120 }
#define lapack_logical
Definition: lapacke.h:51
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:122
lapack_int LAPACKE_dggevx_work(int matrix_layout, char balanc, char jobvl, char jobvr, char sense, lapack_int n, double *a, lapack_int lda, double *b, lapack_int ldb, double *alphar, double *alphai, double *beta, double *vl, lapack_int ldvl, double *vr, lapack_int ldvr, lapack_int *ilo, lapack_int *ihi, double *lscale, double *rscale, double *abnrm, double *bbnrm, double *rconde, double *rcondv, double *work, lapack_int lwork, lapack_int *iwork, lapack_logical *bwork)
#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_free(p)
Definition: lapacke.h:113
#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

Here is the call graph for this function: