LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_sgges3 ( int  matrix_layout,
char  jobvsl,
char  jobvsr,
char  sort,
LAPACK_S_SELECT3  selctg,
lapack_int  n,
float *  a,
lapack_int  lda,
float *  b,
lapack_int  ldb,
lapack_int sdim,
float *  alphar,
float *  alphai,
float *  beta,
float *  vsl,
lapack_int  ldvsl,
float *  vsr,
lapack_int  ldvsr 
)

Definition at line 36 of file lapacke_sgges3.c.

42 {
43  lapack_int info = 0;
44  lapack_int lwork = -1;
45  lapack_logical* bwork = NULL;
46  float* work = NULL;
47  float work_query;
48  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
49  LAPACKE_xerbla( "LAPACKE_sgges3", -1 );
50  return -1;
51  }
52 #ifndef LAPACK_DISABLE_NAN_CHECK
53  /* Optionally check input matrices for NaNs */
54  if( LAPACKE_sge_nancheck( matrix_layout, n, n, a, lda ) ) {
55  return -7;
56  }
57  if( LAPACKE_sge_nancheck( matrix_layout, n, n, b, ldb ) ) {
58  return -9;
59  }
60 #endif
61  /* Allocate memory for working array(s) */
62  if( LAPACKE_lsame( sort, 's' ) ) {
63  bwork = (lapack_logical*)
64  LAPACKE_malloc( sizeof(lapack_logical) * MAX(1,n) );
65  if( bwork == NULL ) {
67  goto exit_level_0;
68  }
69  }
70  /* Query optimal working array(s) size */
71  info = LAPACKE_sgges3_work( matrix_layout, jobvsl, jobvsr, sort, selctg, n,
72  a, lda, b, ldb, sdim, alphar, alphai, beta, vsl,
73  ldvsl, vsr, ldvsr, &work_query, lwork, bwork );
74  if( info != 0 ) {
75  goto exit_level_1;
76  }
77  lwork = (lapack_int)work_query;
78  /* Allocate memory for work arrays */
79  work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
80  if( work == NULL ) {
82  goto exit_level_1;
83  }
84  /* Call middle-level interface */
85  info = LAPACKE_sgges3_work( matrix_layout, jobvsl, jobvsr, sort, selctg, n,
86  a, lda, b, ldb, sdim, alphar, alphai, beta, vsl,
87  ldvsl, vsr, ldvsr, work, lwork, bwork );
88  /* Release memory and exit */
89  LAPACKE_free( work );
90 exit_level_1:
91  if( LAPACKE_lsame( sort, 's' ) ) {
92  LAPACKE_free( bwork );
93  }
94 exit_level_0:
95  if( info == LAPACK_WORK_MEMORY_ERROR ) {
96  LAPACKE_xerbla( "LAPACKE_sgges3", info );
97  }
98  return info;
99 }
#define lapack_logical
Definition: lapacke.h:51
lapack_int LAPACKE_sgges3_work(int matrix_layout, char jobvsl, char jobvsr, char sort, LAPACK_S_SELECT3 selctg, lapack_int n, float *a, lapack_int lda, float *b, lapack_int ldb, lapack_int *sdim, float *alphar, float *alphai, float *beta, float *vsl, lapack_int ldvsl, float *vsr, lapack_int ldvsr, float *work, lapack_int lwork, lapack_logical *bwork)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:122
lapack_logical LAPACKE_sge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const float *a, lapack_int lda)
#define MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACKE_free(p)
Definition: lapacke.h:113
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:36
#define LAPACK_COL_MAJOR
Definition: lapacke.h:120
void LAPACKE_xerbla(const char *name, lapack_int info)
#define lapack_int
Definition: lapacke.h:47

Here is the call graph for this function: