LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dsbevx_2stage()

lapack_int LAPACKE_dsbevx_2stage ( int  matrix_layout,
char  jobz,
char  range,
char  uplo,
lapack_int  n,
lapack_int  kd,
double *  ab,
lapack_int  ldab,
double *  q,
lapack_int  ldq,
double  vl,
double  vu,
lapack_int  il,
lapack_int  iu,
double  abstol,
lapack_int m,
double *  w,
double *  z,
lapack_int  ldz,
lapack_int ifail 
)

Definition at line 35 of file lapacke_dsbevx_2stage.c.

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