LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dtgsen()

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  if( LAPACKE_get_nancheck() ) {
57  /* Optionally check input matrices for NaNs */
58  if( LAPACKE_dge_nancheck( matrix_layout, n, n, a, lda ) ) {
59  return -7;
60  }
61  if( LAPACKE_dge_nancheck( matrix_layout, n, n, b, ldb ) ) {
62  return -9;
63  }
64  if( wantq ) {
65  if( LAPACKE_dge_nancheck( matrix_layout, n, n, q, ldq ) ) {
66  return -14;
67  }
68  }
69  if( wantz ) {
70  if( LAPACKE_dge_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_dtgsen_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 = (double*)LAPACKE_malloc( sizeof(double) * lwork );
95  if( work == NULL ) {
97  goto exit_level_1;
98  }
99  /* Call middle-level interface */
100  info = LAPACKE_dtgsen_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_dtgsen", info );
113  }
114  return info;
115 }
#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_dge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const double *a, lapack_int lda)
#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
int LAPACKE_get_nancheck()
Here is the call graph for this function: