LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_zstedc()

lapack_int LAPACKE_zstedc ( int  matrix_layout,
char  compz,
lapack_int  n,
double *  d,
double *  e,
lapack_complex_double z,
lapack_int  ldz 
)

Definition at line 36 of file lapacke_zstedc.c.

39 {
40  lapack_int info = 0;
41  lapack_int liwork = -1;
42  lapack_int lrwork = -1;
43  lapack_int lwork = -1;
44  lapack_int* iwork = NULL;
45  double* rwork = NULL;
46  lapack_complex_double* work = NULL;
47  lapack_int iwork_query;
48  double rwork_query;
49  lapack_complex_double work_query;
50  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
51  LAPACKE_xerbla( "LAPACKE_zstedc", -1 );
52  return -1;
53  }
54 #ifndef LAPACK_DISABLE_NAN_CHECK
55  if( LAPACKE_get_nancheck() ) {
56  /* Optionally check input matrices for NaNs */
57  if( LAPACKE_d_nancheck( n, d, 1 ) ) {
58  return -4;
59  }
60  if( LAPACKE_d_nancheck( n-1, e, 1 ) ) {
61  return -5;
62  }
63  if( LAPACKE_lsame( compz, 'v' ) ) {
64  if( LAPACKE_zge_nancheck( matrix_layout, n, n, z, ldz ) ) {
65  return -6;
66  }
67  }
68  }
69 #endif
70  /* Query optimal working array(s) size */
71  info = LAPACKE_zstedc_work( matrix_layout, compz, n, d, e, z, ldz,
72  &work_query, lwork, &rwork_query, lrwork,
73  &iwork_query, liwork );
74  if( info != 0 ) {
75  goto exit_level_0;
76  }
77  liwork = (lapack_int)iwork_query;
78  lrwork = (lapack_int)rwork_query;
79  lwork = LAPACK_Z2INT( work_query );
80  /* Allocate memory for work arrays */
81  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
82  if( iwork == NULL ) {
84  goto exit_level_0;
85  }
86  rwork = (double*)LAPACKE_malloc( sizeof(double) * lrwork );
87  if( rwork == NULL ) {
89  goto exit_level_1;
90  }
91  work = (lapack_complex_double*)
92  LAPACKE_malloc( sizeof(lapack_complex_double) * lwork );
93  if( work == NULL ) {
95  goto exit_level_2;
96  }
97  /* Call middle-level interface */
98  info = LAPACKE_zstedc_work( matrix_layout, compz, n, d, e, z, ldz, work,
99  lwork, rwork, lrwork, iwork, liwork );
100  /* Release memory and exit */
101  LAPACKE_free( work );
102 exit_level_2:
103  LAPACKE_free( rwork );
104 exit_level_1:
105  LAPACKE_free( iwork );
106 exit_level_0:
107  if( info == LAPACK_WORK_MEMORY_ERROR ) {
108  LAPACKE_xerbla( "LAPACKE_zstedc", info );
109  }
110  return info;
111 }
#define LAPACK_Z2INT(x)
Definition: lapacke.h:117
#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
#define lapack_complex_double
Definition: lapacke.h:90
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
lapack_logical LAPACKE_d_nancheck(lapack_int n, const double *x, lapack_int incx)
lapack_int LAPACKE_zstedc_work(int matrix_layout, char compz, lapack_int n, double *d, double *e, lapack_complex_double *z, lapack_int ldz, lapack_complex_double *work, lapack_int lwork, double *rwork, lapack_int lrwork, lapack_int *iwork, lapack_int liwork)
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
lapack_logical LAPACKE_zge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_double *a, lapack_int lda)
int LAPACKE_get_nancheck()
Here is the call graph for this function: