LAPACK  3.7.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 36 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  /* 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 #endif
74  /* Query optimal working array(s) size */
75  info = LAPACKE_stgsen_work( matrix_layout, ijob, wantq, wantz, select, n, a,
76  lda, b, ldb, alphar, alphai, beta, q, ldq, z,
77  ldz, m, pl, pr, dif, &work_query, lwork,
78  &iwork_query, liwork );
79  if( info != 0 ) {
80  goto exit_level_0;
81  }
82  liwork = (lapack_int)iwork_query;
83  lwork = (lapack_int)work_query;
84  /* Allocate memory for work arrays */
85  if( ijob != 0 ) {
86  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
87  if( iwork == NULL ) {
89  goto exit_level_0;
90  }
91  }
92  work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
93  if( work == NULL ) {
95  goto exit_level_1;
96  }
97  /* Call middle-level interface */
98  info = LAPACKE_stgsen_work( matrix_layout, ijob, wantq, wantz, select, n, a,
99  lda, b, ldb, alphar, alphai, beta, q, ldq, z,
100  ldz, m, pl, pr, dif, work, lwork, iwork,
101  liwork );
102  /* Release memory and exit */
103  LAPACKE_free( work );
104 exit_level_1:
105  if( ijob != 0 ) {
106  LAPACKE_free( iwork );
107  }
108 exit_level_0:
109  if( info == LAPACK_WORK_MEMORY_ERROR ) {
110  LAPACKE_xerbla( "LAPACKE_stgsen", info );
111  }
112  return info;
113 }
#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
lapack_logical LAPACKE_sge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const float *a, lapack_int lda)
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
#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_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)
Here is the call graph for this function: