LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_cstegr()

lapack_int LAPACKE_cstegr ( int  matrix_layout,
char  jobz,
char  range,
lapack_int  n,
float *  d,
float *  e,
float  vl,
float  vu,
lapack_int  il,
lapack_int  iu,
float  abstol,
lapack_int m,
float *  w,
lapack_complex_float z,
lapack_int  ldz,
lapack_int isuppz 
)

Definition at line 35 of file lapacke_cstegr.c.

40 {
41  lapack_int info = 0;
42  lapack_int liwork = -1;
43  lapack_int lwork = -1;
44  lapack_int* iwork = NULL;
45  float* work = NULL;
46  lapack_int iwork_query;
47  float work_query;
48  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
49  LAPACKE_xerbla( "LAPACKE_cstegr", -1 );
50  return -1;
51  }
52 #ifndef LAPACK_DISABLE_NAN_CHECK
53  if( LAPACKE_get_nancheck() ) {
54  /* Optionally check input matrices for NaNs */
55  if( LAPACKE_s_nancheck( 1, &abstol, 1 ) ) {
56  return -11;
57  }
58  if( LAPACKE_s_nancheck( n, d, 1 ) ) {
59  return -5;
60  }
61  if( LAPACKE_s_nancheck( n-1, e, 1 ) ) {
62  return -6;
63  }
64  if( LAPACKE_lsame( range, 'v' ) ) {
65  if( LAPACKE_s_nancheck( 1, &vl, 1 ) ) {
66  return -7;
67  }
68  }
69  if( LAPACKE_lsame( range, 'v' ) ) {
70  if( LAPACKE_s_nancheck( 1, &vu, 1 ) ) {
71  return -8;
72  }
73  }
74  }
75 #endif
76  /* Query optimal working array(s) size */
77  info = LAPACKE_cstegr_work( matrix_layout, jobz, range, n, d, e, vl, vu, il,
78  iu, abstol, m, w, z, ldz, isuppz, &work_query,
79  lwork, &iwork_query, liwork );
80  if( info != 0 ) {
81  goto exit_level_0;
82  }
83  liwork = iwork_query;
84  lwork = (lapack_int)work_query;
85  /* Allocate memory for work arrays */
86  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
87  if( iwork == NULL ) {
89  goto exit_level_0;
90  }
91  work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
92  if( work == NULL ) {
94  goto exit_level_1;
95  }
96  /* Call middle-level interface */
97  info = LAPACKE_cstegr_work( matrix_layout, jobz, range, n, d, e, vl, vu, il,
98  iu, abstol, m, w, z, ldz, isuppz, work, lwork,
99  iwork, liwork );
100  /* Release memory and exit */
101  LAPACKE_free( work );
102 exit_level_1:
103  LAPACKE_free( iwork );
104 exit_level_0:
105  if( info == LAPACK_WORK_MEMORY_ERROR ) {
106  LAPACKE_xerbla( "LAPACKE_cstegr", info );
107  }
108  return info;
109 }
#define lapack_int
Definition: lapack.h:83
#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_cstegr_work(int matrix_layout, char jobz, char range, lapack_int n, float *d, float *e, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int *m, float *w, lapack_complex_float *z, lapack_int ldz, lapack_int *isuppz, float *work, lapack_int lwork, lapack_int *iwork, lapack_int liwork)
#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_s_nancheck(lapack_int n, const float *x, lapack_int incx)
Here is the call graph for this function: