LAPACK  3.10.1
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.

43 {
44  lapack_int info = 0;
45  lapack_int lwork = -1;
46  lapack_logical* bwork = NULL;
47  lapack_int* iwork = NULL;
48  double* work = NULL;
49  double work_query;
50  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
51  LAPACKE_xerbla( "LAPACKE_dggevx", -1 );
52  return -1;
53  }
54 #ifndef LAPACK_DISABLE_NAN_CHECK
55  if( LAPACKE_get_nancheck() ) {
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  }
64 #endif
65  /* Allocate memory for working array(s) */
66  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'e' ) ||
67  LAPACKE_lsame( sense, 'v' ) ) {
68  bwork = (lapack_logical*)
69  LAPACKE_malloc( sizeof(lapack_logical) * MAX(1,n) );
70  if( bwork == NULL ) {
72  goto exit_level_0;
73  }
74  }
75  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'n' ) ||
76  LAPACKE_lsame( sense, 'v' ) ) {
77  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,n+6) );
78  if( iwork == NULL ) {
80  goto exit_level_1;
81  }
82  }
83  /* Query optimal working array(s) size */
84  info = LAPACKE_dggevx_work( matrix_layout, balanc, jobvl, jobvr, sense, n, a,
85  lda, b, ldb, alphar, alphai, beta, vl, ldvl, vr,
86  ldvr, ilo, ihi, lscale, rscale, abnrm, bbnrm,
87  rconde, rcondv, &work_query, lwork, iwork,
88  bwork );
89  if( info != 0 ) {
90  goto exit_level_2;
91  }
92  lwork = (lapack_int)work_query;
93  /* Allocate memory for work arrays */
94  work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
95  if( work == NULL ) {
97  goto exit_level_2;
98  }
99  /* Call middle-level interface */
100  info = LAPACKE_dggevx_work( matrix_layout, balanc, jobvl, jobvr, sense, n, a,
101  lda, b, ldb, alphar, alphai, beta, vl, ldvl, vr,
102  ldvr, ilo, ihi, lscale, rscale, abnrm, bbnrm,
103  rconde, rcondv, work, lwork, iwork, bwork );
104  /* Release memory and exit */
105  LAPACKE_free( work );
106 exit_level_2:
107  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'n' ) ||
108  LAPACKE_lsame( sense, 'v' ) ) {
109  LAPACKE_free( iwork );
110  }
111 exit_level_1:
112  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'e' ) ||
113  LAPACKE_lsame( sense, 'v' ) ) {
114  LAPACKE_free( bwork );
115  }
116 exit_level_0:
117  if( info == LAPACK_WORK_MEMORY_ERROR ) {
118  LAPACKE_xerbla( "LAPACKE_dggevx", info );
119  }
120  return info;
121 }
#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_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 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: