LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_dtgsen ( int  matrix_layout,
lapack_int  ijob,
lapack_logical  wantq,
lapack_logical  wantz,
const lapack_logical select,
lapack_int  n,
double *  a,
lapack_int  lda,
double *  b,
lapack_int  ldb,
double *  alphar,
double *  alphai,
double *  beta,
double *  q,
lapack_int  ldq,
double *  z,
lapack_int  ldz,
lapack_int m,
double *  pl,
double *  pr,
double *  dif 
)

Definition at line 36 of file lapacke_dtgsen.c.

43 {
44  lapack_int info = 0;
45  lapack_int liwork = -1;
46  lapack_int lwork = -1;
47  lapack_int* iwork = NULL;
48  double* work = NULL;
49  lapack_int iwork_query;
50  double work_query;
51  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
52  LAPACKE_xerbla( "LAPACKE_dtgsen", -1 );
53  return -1;
54  }
55 #ifndef LAPACK_DISABLE_NAN_CHECK
56  /* Optionally check input matrices for NaNs */
57  if( LAPACKE_dge_nancheck( matrix_layout, n, n, a, lda ) ) {
58  return -7;
59  }
60  if( LAPACKE_dge_nancheck( matrix_layout, n, n, b, ldb ) ) {
61  return -9;
62  }
63  if( wantq ) {
64  if( LAPACKE_dge_nancheck( matrix_layout, n, n, q, ldq ) ) {
65  return -14;
66  }
67  }
68  if( wantz ) {
69  if( LAPACKE_dge_nancheck( matrix_layout, n, n, z, ldz ) ) {
70  return -16;
71  }
72  }
73 #endif
74  /* Query optimal working array(s) size */
75  info = LAPACKE_dtgsen_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 = (double*)LAPACKE_malloc( sizeof(double) * lwork );
93  if( work == NULL ) {
95  goto exit_level_1;
96  }
97  /* Call middle-level interface */
98  info = LAPACKE_dtgsen_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_dtgsen", info );
111  }
112  return info;
113 }
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:122
lapack_logical LAPACKE_dge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const double *a, lapack_int lda)
#define LAPACKE_free(p)
Definition: lapacke.h:113
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
lapack_int LAPACKE_dtgsen_work(int matrix_layout, lapack_int ijob, lapack_logical wantq, lapack_logical wantz, const lapack_logical *select, lapack_int n, double *a, lapack_int lda, double *b, lapack_int ldb, double *alphar, double *alphai, double *beta, double *q, lapack_int ldq, double *z, lapack_int ldz, lapack_int *m, double *pl, double *pr, double *dif, double *work, lapack_int lwork, lapack_int *iwork, lapack_int liwork)
#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: