LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dgges3()

lapack_int LAPACKE_dgges3 ( int  matrix_layout,
char  jobvsl,
char  jobvsr,
char  sort,
LAPACK_D_SELECT3  selctg,
lapack_int  n,
double *  a,
lapack_int  lda,
double *  b,
lapack_int  ldb,
lapack_int sdim,
double *  alphar,
double *  alphai,
double *  beta,
double *  vsl,
lapack_int  ldvsl,
double *  vsr,
lapack_int  ldvsr 
)

Definition at line 35 of file lapacke_dgges3.c.

41 {
42  lapack_int info = 0;
43  lapack_int lwork = -1;
44  lapack_logical* bwork = NULL;
45  double* work = NULL;
46  double work_query;
47  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
48  LAPACKE_xerbla( "LAPACKE_dgges3", -1 );
49  return -1;
50  }
51 #ifndef LAPACK_DISABLE_NAN_CHECK
52  if( LAPACKE_get_nancheck() ) {
53  /* Optionally check input matrices for NaNs */
54  if( LAPACKE_dge_nancheck( matrix_layout, n, n, a, lda ) ) {
55  return -7;
56  }
57  if( LAPACKE_dge_nancheck( matrix_layout, n, n, b, ldb ) ) {
58  return -9;
59  }
60  }
61 #endif
62  /* Allocate memory for working array(s) */
63  if( LAPACKE_lsame( sort, 's' ) ) {
64  bwork = (lapack_logical*)
65  LAPACKE_malloc( sizeof(lapack_logical) * MAX(1,n) );
66  if( bwork == NULL ) {
68  goto exit_level_0;
69  }
70  }
71  /* Query optimal working array(s) size */
72  info = LAPACKE_dgges3_work( matrix_layout, jobvsl, jobvsr, sort, selctg,
73  n, a, lda, b, ldb, sdim, alphar, alphai, beta,
74  vsl, ldvsl, vsr, ldvsr,
75  &work_query, lwork, bwork );
76  if( info != 0 ) {
77  goto exit_level_1;
78  }
79  lwork = (lapack_int)work_query;
80  /* Allocate memory for work arrays */
81  work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
82  if( work == NULL ) {
84  goto exit_level_1;
85  }
86  /* Call middle-level interface */
87  info = LAPACKE_dgges3_work( matrix_layout, jobvsl, jobvsr, sort, selctg,
88  n, a, lda, b, ldb, sdim, alphar, alphai, beta,
89  vsl, ldvsl, vsr, ldvsr, work, lwork, bwork );
90  /* Release memory and exit */
91  LAPACKE_free( work );
92 exit_level_1:
93  if( LAPACKE_lsame( sort, 's' ) ) {
94  LAPACKE_free( bwork );
95  }
96 exit_level_0:
97  if( info == LAPACK_WORK_MEMORY_ERROR ) {
98  LAPACKE_xerbla( "LAPACKE_dgges3", info );
99  }
100  return info;
101 }
#define lapack_int
Definition: lapack.h:83
#define lapack_logical
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
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:52
lapack_int LAPACKE_dgges3_work(int matrix_layout, char jobvsl, char jobvsr, char sort, LAPACK_D_SELECT3 selctg, lapack_int n, double *a, lapack_int lda, double *b, lapack_int ldb, lapack_int *sdim, double *alphar, double *alphai, double *beta, double *vsl, lapack_int ldvsl, double *vsr, lapack_int ldvsr, double *work, lapack_int lwork, lapack_logical *bwork)
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)
#define MAX(x, y)
Definition: lapacke_utils.h:46
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: