LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_ssbgvd()

lapack_int LAPACKE_ssbgvd ( int  matrix_layout,
char  jobz,
char  uplo,
lapack_int  n,
lapack_int  ka,
lapack_int  kb,
float *  ab,
lapack_int  ldab,
float *  bb,
lapack_int  ldbb,
float *  w,
float *  z,
lapack_int  ldz 
)

Definition at line 36 of file lapacke_ssbgvd.c.

40 {
41  lapack_int info = 0;
42  lapack_int liwork = -1;
43  lapack_int lwork = -1;
44  lapack_int* iwork = NULL;
45  float* work = NULL;
46  lapack_int iwork_query;
47  float work_query;
48  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
49  LAPACKE_xerbla( "LAPACKE_ssbgvd", -1 );
50  return -1;
51  }
52 #ifndef LAPACK_DISABLE_NAN_CHECK
53  if( LAPACKE_get_nancheck() ) {
54  /* Optionally check input matrices for NaNs */
55  if( LAPACKE_ssb_nancheck( matrix_layout, uplo, n, ka, ab, ldab ) ) {
56  return -7;
57  }
58  if( LAPACKE_ssb_nancheck( matrix_layout, uplo, n, kb, bb, ldbb ) ) {
59  return -9;
60  }
61  }
62 #endif
63  /* Query optimal working array(s) size */
64  info = LAPACKE_ssbgvd_work( matrix_layout, jobz, uplo, n, ka, kb, ab, ldab,
65  bb, ldbb, w, z, ldz, &work_query, lwork,
66  &iwork_query, liwork );
67  if( info != 0 ) {
68  goto exit_level_0;
69  }
70  liwork = (lapack_int)iwork_query;
71  lwork = (lapack_int)work_query;
72  /* Allocate memory for work arrays */
73  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
74  if( iwork == NULL ) {
76  goto exit_level_0;
77  }
78  work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
79  if( work == NULL ) {
81  goto exit_level_1;
82  }
83  /* Call middle-level interface */
84  info = LAPACKE_ssbgvd_work( matrix_layout, jobz, uplo, n, ka, kb, ab, ldab,
85  bb, ldbb, w, z, ldz, work, lwork, iwork,
86  liwork );
87  /* Release memory and exit */
88  LAPACKE_free( work );
89 exit_level_1:
90  LAPACKE_free( iwork );
91 exit_level_0:
92  if( info == LAPACK_WORK_MEMORY_ERROR ) {
93  LAPACKE_xerbla( "LAPACKE_ssbgvd", info );
94  }
95  return info;
96 }
#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
lapack_int LAPACKE_ssbgvd_work(int matrix_layout, char jobz, char uplo, lapack_int n, lapack_int ka, lapack_int kb, float *ab, lapack_int ldab, float *bb, lapack_int ldbb, float *w, float *z, lapack_int ldz, float *work, lapack_int lwork, lapack_int *iwork, lapack_int liwork)
lapack_logical LAPACKE_ssb_nancheck(int matrix_layout, char uplo, lapack_int n, lapack_int kd, const float *ab, lapack_int ldab)
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
#define LAPACK_COL_MAJOR
Definition: lapacke.h:120
void LAPACKE_xerbla(const char *name, lapack_int info)
#define lapack_int
Definition: lapacke.h:47
int LAPACKE_get_nancheck()
Here is the call graph for this function: