LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dggevx()

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 35 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  if( LAPACKE_get_nancheck() ) {
57  /* Optionally check input matrices for NaNs */
58  if( LAPACKE_dge_nancheck( matrix_layout, n, n, a, lda ) ) {
59  return -7;
60  }
61  if( LAPACKE_dge_nancheck( matrix_layout, n, n, b, ldb ) ) {
62  return -9;
63  }
64  }
65 #endif
66  /* Allocate memory for working array(s) */
67  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'e' ) ||
68  LAPACKE_lsame( sense, 'v' ) ) {
69  bwork = (lapack_logical*)
70  LAPACKE_malloc( sizeof(lapack_logical) * MAX(1,n) );
71  if( bwork == NULL ) {
73  goto exit_level_0;
74  }
75  }
76  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'n' ) ||
77  LAPACKE_lsame( sense, 'v' ) ) {
78  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,n+6) );
79  if( iwork == NULL ) {
81  goto exit_level_1;
82  }
83  }
84  /* Query optimal working array(s) size */
85  info = LAPACKE_dggevx_work( matrix_layout, balanc, jobvl, jobvr, sense, n, a,
86  lda, b, ldb, alphar, alphai, beta, vl, ldvl, vr,
87  ldvr, ilo, ihi, lscale, rscale, abnrm, bbnrm,
88  rconde, rcondv, &work_query, lwork, iwork,
89  bwork );
90  if( info != 0 ) {
91  goto exit_level_2;
92  }
93  lwork = (lapack_int)work_query;
94  /* Allocate memory for work arrays */
95  work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
96  if( work == NULL ) {
98  goto exit_level_2;
99  }
100  /* Call middle-level interface */
101  info = LAPACKE_dggevx_work( matrix_layout, balanc, jobvl, jobvr, sense, n, a,
102  lda, b, ldb, alphar, alphai, beta, vl, ldvl, vr,
103  ldvr, ilo, ihi, lscale, rscale, abnrm, bbnrm,
104  rconde, rcondv, work, lwork, iwork, bwork );
105  /* Release memory and exit */
106  LAPACKE_free( work );
107 exit_level_2:
108  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'n' ) ||
109  LAPACKE_lsame( sense, 'v' ) ) {
110  LAPACKE_free( iwork );
111  }
112 exit_level_1:
113  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'e' ) ||
114  LAPACKE_lsame( sense, 'v' ) ) {
115  LAPACKE_free( bwork );
116  }
117 exit_level_0:
118  if( info == LAPACK_WORK_MEMORY_ERROR ) {
119  LAPACKE_xerbla( "LAPACKE_dggevx", info );
120  }
121  return info;
Here is the call graph for this function:
LAPACKE_free
#define LAPACKE_free(p)
Definition: lapacke.h:47
lapack_int
#define lapack_int
Definition: lapack.h:21
LAPACKE_dge_nancheck
lapack_logical LAPACKE_dge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const double *a, lapack_int lda)
Definition: lapacke_dge_nancheck.c:36
LAPACK_WORK_MEMORY_ERROR
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:56
LAPACKE_xerbla
void LAPACKE_xerbla(const char *name, lapack_int info)
Definition: lapacke_xerbla.c:36
MAX
#define MAX(x, y)
Definition: lapacke_utils.h:47
lapack_logical
#define lapack_logical
Definition: lapack.h:25
LAPACKE_malloc
#define LAPACKE_malloc(size)
Definition: lapacke.h:44
LAPACKE_get_nancheck
int LAPACKE_get_nancheck()
Definition: lapacke_nancheck.c:42
LAPACKE_lsame
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
LAPACK_ROW_MAJOR
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:53
LAPACK_COL_MAJOR
#define LAPACK_COL_MAJOR
Definition: lapacke.h:54
LAPACKE_dggevx_work
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)
Definition: lapacke_dggevx_work.c:35