LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_sgees ( int  matrix_layout,
char  jobvs,
char  sort,
LAPACK_S_SELECT2  select,
lapack_int  n,
float *  a,
lapack_int  lda,
lapack_int sdim,
float *  wr,
float *  wi,
float *  vs,
lapack_int  ldvs 
)

Definition at line 36 of file lapacke_sgees.c.

40 {
41  lapack_int info = 0;
42  lapack_int lwork = -1;
43  lapack_logical* bwork = NULL;
44  float* work = NULL;
45  float work_query;
46  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
47  LAPACKE_xerbla( "LAPACKE_sgees", -1 );
48  return -1;
49  }
50 #ifndef LAPACK_DISABLE_NAN_CHECK
51  /* Optionally check input matrices for NaNs */
52  if( LAPACKE_sge_nancheck( matrix_layout, n, n, a, lda ) ) {
53  return -6;
54  }
55 #endif
56  /* Allocate memory for working array(s) */
57  if( LAPACKE_lsame( sort, 's' ) ) {
58  bwork = (lapack_logical*)
59  LAPACKE_malloc( sizeof(lapack_logical) * MAX(1,n) );
60  if( bwork == NULL ) {
62  goto exit_level_0;
63  }
64  }
65  /* Query optimal working array(s) size */
66  info = LAPACKE_sgees_work( matrix_layout, jobvs, sort, select, n, a, lda,
67  sdim, wr, wi, vs, ldvs, &work_query, lwork,
68  bwork );
69  if( info != 0 ) {
70  goto exit_level_1;
71  }
72  lwork = (lapack_int)work_query;
73  /* Allocate memory for work arrays */
74  work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
75  if( work == NULL ) {
77  goto exit_level_1;
78  }
79  /* Call middle-level interface */
80  info = LAPACKE_sgees_work( matrix_layout, jobvs, sort, select, n, a, lda,
81  sdim, wr, wi, vs, ldvs, work, lwork, bwork );
82  /* Release memory and exit */
83  LAPACKE_free( work );
84 exit_level_1:
85  if( LAPACKE_lsame( sort, 's' ) ) {
86  LAPACKE_free( bwork );
87  }
88 exit_level_0:
89  if( info == LAPACK_WORK_MEMORY_ERROR ) {
90  LAPACKE_xerbla( "LAPACKE_sgees", info );
91  }
92  return info;
93 }
#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_logical LAPACKE_sge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const float *a, lapack_int lda)
lapack_int LAPACKE_sgees_work(int matrix_layout, char jobvs, char sort, LAPACK_S_SELECT2 select, lapack_int n, float *a, lapack_int lda, lapack_int *sdim, float *wr, float *wi, float *vs, lapack_int ldvs, float *work, lapack_int lwork, lapack_logical *bwork)
#define MAX(x, y)
Definition: lapacke_utils.h:47
#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: