LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_stgsen()

lapack_int LAPACKE_stgsen ( int  matrix_layout,
lapack_int  ijob,
lapack_logical  wantq,
lapack_logical  wantz,
const lapack_logical select,
lapack_int  n,
float *  a,
lapack_int  lda,
float *  b,
lapack_int  ldb,
float *  alphar,
float *  alphai,
float *  beta,
float *  q,
lapack_int  ldq,
float *  z,
lapack_int  ldz,
lapack_int m,
float *  pl,
float *  pr,
float *  dif 
)

Definition at line 35 of file lapacke_stgsen.c.

43 {
44  lapack_int info = 0;
45  lapack_int liwork = -1;
46  lapack_int lwork = -1;
47  lapack_int* iwork = NULL;
48  float* work = NULL;
49  lapack_int iwork_query;
50  float work_query;
51  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
52  LAPACKE_xerbla( "LAPACKE_stgsen", -1 );
53  return -1;
54  }
55 #ifndef LAPACK_DISABLE_NAN_CHECK
56  if( LAPACKE_get_nancheck() ) {
57  /* Optionally check input matrices for NaNs */
58  if( LAPACKE_sge_nancheck( matrix_layout, n, n, a, lda ) ) {
59  return -7;
60  }
61  if( LAPACKE_sge_nancheck( matrix_layout, n, n, b, ldb ) ) {
62  return -9;
63  }
64  if( wantq ) {
65  if( LAPACKE_sge_nancheck( matrix_layout, n, n, q, ldq ) ) {
66  return -14;
67  }
68  }
69  if( wantz ) {
70  if( LAPACKE_sge_nancheck( matrix_layout, n, n, z, ldz ) ) {
71  return -16;
72  }
73  }
74  }
75 #endif
76  /* Query optimal working array(s) size */
77  info = LAPACKE_stgsen_work( matrix_layout, ijob, wantq, wantz, select, n, a,
78  lda, b, ldb, alphar, alphai, beta, q, ldq, z,
79  ldz, m, pl, pr, dif, &work_query, lwork,
80  &iwork_query, liwork );
81  if( info != 0 ) {
82  goto exit_level_0;
83  }
84  liwork = (lapack_int)iwork_query;
85  lwork = (lapack_int)work_query;
86  /* Allocate memory for work arrays */
87  if( ijob != 0 ) {
88  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
89  if( iwork == NULL ) {
91  goto exit_level_0;
92  }
93  }
94  work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
95  if( work == NULL ) {
97  goto exit_level_1;
98  }
99  /* Call middle-level interface */
100  info = LAPACKE_stgsen_work( matrix_layout, ijob, wantq, wantz, select, n, a,
101  lda, b, ldb, alphar, alphai, beta, q, ldq, z,
102  ldz, m, pl, pr, dif, work, lwork, iwork,
103  liwork );
104  /* Release memory and exit */
105  LAPACKE_free( work );
106 exit_level_1:
107  if( ijob != 0 ) {
108  LAPACKE_free( iwork );
109  }
110 exit_level_0:
111  if( info == LAPACK_WORK_MEMORY_ERROR ) {
112  LAPACKE_xerbla( "LAPACKE_stgsen", info );
113  }
114  return info;
Here is the call graph for this function:
LAPACKE_free
#define LAPACKE_free(p)
Definition: lapacke.h:47
lapack_int
#define lapack_int
Definition: lapack.h:21
LAPACK_WORK_MEMORY_ERROR
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:56
LAPACKE_xerbla
void LAPACKE_xerbla(const char *name, lapack_int info)
Definition: lapacke_xerbla.c:36
LAPACKE_sge_nancheck
lapack_logical LAPACKE_sge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const float *a, lapack_int lda)
Definition: lapacke_sge_nancheck.c:36
LAPACKE_malloc
#define LAPACKE_malloc(size)
Definition: lapacke.h:44
LAPACKE_get_nancheck
int LAPACKE_get_nancheck()
Definition: lapacke_nancheck.c:42
LAPACKE_stgsen_work
lapack_int LAPACKE_stgsen_work(int matrix_layout, lapack_int ijob, lapack_logical wantq, lapack_logical wantz, const lapack_logical *select, lapack_int n, float *a, lapack_int lda, float *b, lapack_int ldb, float *alphar, float *alphai, float *beta, float *q, lapack_int ldq, float *z, lapack_int ldz, lapack_int *m, float *pl, float *pr, float *dif, float *work, lapack_int lwork, lapack_int *iwork, lapack_int liwork)
Definition: lapacke_stgsen_work.c:35
LAPACK_ROW_MAJOR
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:53
LAPACK_COL_MAJOR
#define LAPACK_COL_MAJOR
Definition: lapacke.h:54