LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_ssyevd_2stage()

lapack_int LAPACKE_ssyevd_2stage ( int  matrix_layout,
char  jobz,
char  uplo,
lapack_int  n,
float *  a,
lapack_int  lda,
float *  w 
)

Definition at line 35 of file lapacke_ssyevd_2stage.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_ssyevd_2stage", -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_ssy_nancheck( matrix_layout, uplo, n, a, lda ) ) {
53  return -5;
54  }
55  }
56 #endif
57  /* Query optimal working array(s) size */
58  info = LAPACKE_ssyevd_2stage_work( matrix_layout, jobz, uplo, n, a, lda, w,
59  &work_query, lwork, &iwork_query, liwork );
60  if( info != 0 ) {
61  goto exit_level_0;
62  }
63  liwork = iwork_query;
64  lwork = (lapack_int)work_query;
65  /* Allocate memory for work arrays */
66  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
67  if( iwork == NULL ) {
69  goto exit_level_0;
70  }
71  work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
72  if( work == NULL ) {
74  goto exit_level_1;
75  }
76  /* Call middle-level interface */
77  info = LAPACKE_ssyevd_2stage_work( matrix_layout, jobz, uplo, n, a, lda, w, work,
78  lwork, iwork, liwork );
79  /* Release memory and exit */
80  LAPACKE_free( work );
81 exit_level_1:
82  LAPACKE_free( iwork );
83 exit_level_0:
84  if( info == LAPACK_WORK_MEMORY_ERROR ) {
85  LAPACKE_xerbla( "LAPACKE_ssyevd_2stage", info );
86  }
87  return info;
88 }
#define lapack_int
Definition: lapack.h:83
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:55
lapack_int LAPACKE_ssyevd_2stage_work(int matrix_layout, char jobz, char uplo, lapack_int n, float *a, lapack_int lda, float *w, float *work, lapack_int lwork, lapack_int *iwork, lapack_int liwork)
#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
void LAPACKE_xerbla(const char *name, lapack_int info)
lapack_logical LAPACKE_ssy_nancheck(int matrix_layout, char uplo, lapack_int n, const float *a, lapack_int lda)
Here is the call graph for this function: