LAPACK  3.7.1
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  /* Optionally check input matrices for NaNs */
56  if( LAPACKE_d_nancheck( n, d, 1 ) ) {
57  return -4;
58  }
59  if( LAPACKE_d_nancheck( n-1, e, 1 ) ) {
60  return -5;
61  }
62  if( LAPACKE_lsame( compz, 'v' ) ) {
63  if( LAPACKE_zge_nancheck( matrix_layout, n, n, z, ldz ) ) {
64  return -6;
65  }
66  }
67 #endif
68  /* Query optimal working array(s) size */
69  info = LAPACKE_zstedc_work( matrix_layout, compz, n, d, e, z, ldz,
70  &work_query, lwork, &rwork_query, lrwork,
71  &iwork_query, liwork );
72  if( info != 0 ) {
73  goto exit_level_0;
74  }
75  liwork = (lapack_int)iwork_query;
76  lrwork = (lapack_int)rwork_query;
77  lwork = LAPACK_Z2INT( 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  rwork = (double*)LAPACKE_malloc( sizeof(double) * lrwork );
85  if( rwork == NULL ) {
87  goto exit_level_1;
88  }
89  work = (lapack_complex_double*)
90  LAPACKE_malloc( sizeof(lapack_complex_double) * lwork );
91  if( work == NULL ) {
93  goto exit_level_2;
94  }
95  /* Call middle-level interface */
96  info = LAPACKE_zstedc_work( matrix_layout, compz, n, d, e, z, ldz, work,
97  lwork, rwork, lrwork, iwork, liwork );
98  /* Release memory and exit */
99  LAPACKE_free( work );
100 exit_level_2:
101  LAPACKE_free( rwork );
102 exit_level_1:
103  LAPACKE_free( iwork );
104 exit_level_0:
105  if( info == LAPACK_WORK_MEMORY_ERROR ) {
106  LAPACKE_xerbla( "LAPACKE_zstedc", info );
107  }
108  return info;
109 }
#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)
Here is the call graph for this function: