LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_dsbgvd ( int  matrix_layout,
char  jobz,
char  uplo,
lapack_int  n,
lapack_int  ka,
lapack_int  kb,
double *  ab,
lapack_int  ldab,
double *  bb,
lapack_int  ldbb,
double *  w,
double *  z,
lapack_int  ldz 
)

Definition at line 36 of file lapacke_dsbgvd.c.

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

Here is the call graph for this function: