LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_sgeesx()

lapack_int LAPACKE_sgeesx ( int  matrix_layout,
char  jobvs,
char  sort,
LAPACK_S_SELECT2  select,
char  sense,
lapack_int  n,
float *  a,
lapack_int  lda,
lapack_int sdim,
float *  wr,
float *  wi,
float *  vs,
lapack_int  ldvs,
float *  rconde,
float *  rcondv 
)

Definition at line 35 of file lapacke_sgeesx.c.

40 {
41  lapack_int info = 0;
42  lapack_int liwork = -1;
43  lapack_int lwork = -1;
44  lapack_logical* bwork = NULL;
45  lapack_int* iwork = NULL;
46  float* work = NULL;
47  lapack_int iwork_query;
48  float work_query;
49  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
50  LAPACKE_xerbla( "LAPACKE_sgeesx", -1 );
51  return -1;
52  }
53 #ifndef LAPACK_DISABLE_NAN_CHECK
54  if( LAPACKE_get_nancheck() ) {
55  /* Optionally check input matrices for NaNs */
56  if( LAPACKE_sge_nancheck( matrix_layout, n, n, a, lda ) ) {
57  return -7;
58  }
59  }
60 #endif
61  /* Allocate memory for working array(s) */
62  if( LAPACKE_lsame( sort, 's' ) ) {
63  bwork = (lapack_logical*)
64  LAPACKE_malloc( sizeof(lapack_logical) * MAX(1,n) );
65  if( bwork == NULL ) {
67  goto exit_level_0;
68  }
69  }
70  /* Query optimal working array(s) size */
71  info = LAPACKE_sgeesx_work( matrix_layout, jobvs, sort, select, sense, n, a,
72  lda, sdim, wr, wi, vs, ldvs, rconde, rcondv,
73  &work_query, lwork, &iwork_query, liwork,
74  bwork );
75  if( info != 0 ) {
76  goto exit_level_1;
77  }
78  liwork = iwork_query;
79  lwork = (lapack_int)work_query;
80  /* Allocate memory for work arrays */
81  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'v' ) ) {
82  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
83  if( iwork == NULL ) {
85  goto exit_level_1;
86  }
87  }
88  work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
89  if( work == NULL ) {
91  goto exit_level_2;
92  }
93  /* Call middle-level interface */
94  info = LAPACKE_sgeesx_work( matrix_layout, jobvs, sort, select, sense, n, a,
95  lda, sdim, wr, wi, vs, ldvs, rconde, rcondv,
96  work, lwork, iwork, liwork, bwork );
97  /* Release memory and exit */
98  LAPACKE_free( work );
99 exit_level_2:
100  if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'v' ) ) {
101  LAPACKE_free( iwork );
102  }
103 exit_level_1:
104  if( LAPACKE_lsame( sort, 's' ) ) {
105  LAPACKE_free( bwork );
106  }
107 exit_level_0:
108  if( info == LAPACK_WORK_MEMORY_ERROR ) {
109  LAPACKE_xerbla( "LAPACKE_sgeesx", info );
110  }
111  return info;
112 }
#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
lapack_int LAPACKE_sgeesx_work(int matrix_layout, char jobvs, char sort, LAPACK_S_SELECT2 select, char sense, lapack_int n, float *a, lapack_int lda, lapack_int *sdim, float *wr, float *wi, float *vs, lapack_int ldvs, float *rconde, float *rcondv, float *work, lapack_int lwork, lapack_int *iwork, lapack_int liwork, lapack_logical *bwork)
#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)
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:46
Here is the call graph for this function: