LAPACK  3.7.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_cstemr()

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

Definition at line 36 of file lapacke_cstemr.c.

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