LAPACK  3.9.1
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.

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