LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_sggevx()

lapack_int LAPACKE_sggevx ( int  matrix_layout,
char  balanc,
char  jobvl,
char  jobvr,
char  sense,
lapack_int  n,
float *  a,
lapack_int  lda,
float *  b,
lapack_int  ldb,
float *  alphar,
float *  alphai,
float *  beta,
float *  vl,
lapack_int  ldvl,
float *  vr,
lapack_int  ldvr,
lapack_int ilo,
lapack_int ihi,
float *  lscale,
float *  rscale,
float *  abnrm,
float *  bbnrm,
float *  rconde,
float *  rcondv 
)

Definition at line 36 of file lapacke_sggevx.c.

44 {
45  lapack_int info = 0;
46  lapack_int lwork = -1;
47  lapack_logical* bwork = NULL;
48  lapack_int* iwork = NULL;
49  float* work = NULL;
50  float work_query;
51  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
52  LAPACKE_xerbla( "LAPACKE_sggevx", -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_sge_nancheck( matrix_layout, n, n, a, lda ) ) {
59  return -7;
60  }
61  if( LAPACKE_sge_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_sggevx_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 = (float*)LAPACKE_malloc( sizeof(float) * lwork );
96  if( work == NULL ) {
98  goto exit_level_2;
99  }
100  /* Call middle-level interface */
101  info = LAPACKE_sggevx_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_sggevx", info );
120  }
121  return info;
122 }
lapack_int LAPACKE_sggevx_work(int matrix_layout, char balanc, char jobvl, char jobvr, char sense, lapack_int n, float *a, lapack_int lda, float *b, lapack_int ldb, float *alphar, float *alphai, float *beta, float *vl, lapack_int ldvl, float *vr, lapack_int ldvr, lapack_int *ilo, lapack_int *ihi, float *lscale, float *rscale, float *abnrm, float *bbnrm, float *rconde, float *rcondv, float *work, lapack_int lwork, lapack_int *iwork, lapack_logical *bwork)
#define lapack_logical
Definition: lapacke.h:51
#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
lapack_logical LAPACKE_sge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const float *a, lapack_int lda)
#define MAX(x, y)
Definition: lapacke_utils.h:47
#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
int LAPACKE_get_nancheck()
Here is the call graph for this function: