LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ LAPACKE_dstedc()

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

Definition at line 35 of file lapacke_dstedc.c.

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