LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_sstevd()

lapack_int LAPACKE_sstevd ( int  matrix_layout,
char  jobz,
lapack_int  n,
float *  d,
float *  e,
float *  z,
lapack_int  ldz 
)

Definition at line 35 of file lapacke_sstevd.c.

37 {
38  lapack_int info = 0;
39  lapack_int liwork = -1;
40  lapack_int lwork = -1;
41  lapack_int* iwork = NULL;
42  float* work = NULL;
43  lapack_int iwork_query;
44  float work_query;
45  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
46  LAPACKE_xerbla( "LAPACKE_sstevd", -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_s_nancheck( n, d, 1 ) ) {
53  return -4;
54  }
55  if( LAPACKE_s_nancheck( n-1, e, 1 ) ) {
56  return -5;
57  }
58  }
59 #endif
60  /* Query optimal working array(s) size */
61  info = LAPACKE_sstevd_work( matrix_layout, jobz, n, d, e, z, ldz,
62  &work_query, lwork, &iwork_query, liwork );
63  if( info != 0 ) {
64  goto exit_level_0;
65  }
66  liwork = iwork_query;
67  lwork = (lapack_int)work_query;
68  /* Allocate memory for work arrays */
69  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
70  if( iwork == NULL ) {
72  goto exit_level_0;
73  }
74  work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
75  if( work == NULL ) {
77  goto exit_level_1;
78  }
79  /* Call middle-level interface */
80  info = LAPACKE_sstevd_work( matrix_layout, jobz, n, d, e, z, ldz, work,
81  lwork, iwork, liwork );
82  /* Release memory and exit */
83  LAPACKE_free( work );
84 exit_level_1:
85  LAPACKE_free( iwork );
86 exit_level_0:
87  if( info == LAPACK_WORK_MEMORY_ERROR ) {
88  LAPACKE_xerbla( "LAPACKE_sstevd", info );
89  }
90  return info;
91 }
#define lapack_int
Definition: lapack.h:83
#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
lapack_int LAPACKE_sstevd_work(int matrix_layout, char jobz, lapack_int n, float *d, float *e, float *z, lapack_int ldz, float *work, lapack_int lwork, lapack_int *iwork, lapack_int liwork)
int LAPACKE_get_nancheck(void)
#define LAPACKE_malloc(size)
Definition: lapacke.h:43
void LAPACKE_xerbla(const char *name, lapack_int info)
lapack_logical LAPACKE_s_nancheck(lapack_int n, const float *x, lapack_int incx)
Here is the call graph for this function: