LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_zgeesx_work()

lapack_int LAPACKE_zgeesx_work ( int  matrix_layout,
char  jobvs,
char  sort,
LAPACK_Z_SELECT1  select,
char  sense,
lapack_int  n,
lapack_complex_double a,
lapack_int  lda,
lapack_int sdim,
lapack_complex_double w,
lapack_complex_double vs,
lapack_int  ldvs,
double *  rconde,
double *  rcondv,
lapack_complex_double work,
lapack_int  lwork,
double *  rwork,
lapack_logical bwork 
)

Definition at line 36 of file lapacke_zgeesx_work.c.

45 {
46  lapack_int info = 0;
47  if( matrix_layout == LAPACK_COL_MAJOR ) {
48  /* Call LAPACK function and adjust info */
49  LAPACK_zgeesx( &jobvs, &sort, select, &sense, &n, a, &lda, sdim, w, vs,
50  &ldvs, rconde, rcondv, work, &lwork, rwork, bwork,
51  &info );
52  if( info < 0 ) {
53  info = info - 1;
54  }
55  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
56  lapack_int lda_t = MAX(1,n);
57  lapack_int ldvs_t = MAX(1,n);
58  lapack_complex_double* a_t = NULL;
59  lapack_complex_double* vs_t = NULL;
60  /* Check leading dimension(s) */
61  if( lda < n ) {
62  info = -8;
63  LAPACKE_xerbla( "LAPACKE_zgeesx_work", info );
64  return info;
65  }
66  if( ldvs < n ) {
67  info = -12;
68  LAPACKE_xerbla( "LAPACKE_zgeesx_work", info );
69  return info;
70  }
71  /* Query optimal working array(s) size if requested */
72  if( lwork == -1 ) {
73  LAPACK_zgeesx( &jobvs, &sort, select, &sense, &n, a, &lda_t, sdim,
74  w, vs, &ldvs_t, rconde, rcondv, work, &lwork, rwork,
75  bwork, &info );
76  return (info < 0) ? (info - 1) : info;
77  }
78  /* Allocate memory for temporary array(s) */
79  a_t = (lapack_complex_double*)
80  LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) );
81  if( a_t == NULL ) {
83  goto exit_level_0;
84  }
85  if( LAPACKE_lsame( jobvs, 'v' ) ) {
86  vs_t = (lapack_complex_double*)
88  ldvs_t * MAX(1,n) );
89  if( vs_t == NULL ) {
91  goto exit_level_1;
92  }
93  }
94  /* Transpose input matrices */
95  LAPACKE_zge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
96  /* Call LAPACK function and adjust info */
97  LAPACK_zgeesx( &jobvs, &sort, select, &sense, &n, a_t, &lda_t, sdim, w,
98  vs_t, &ldvs_t, rconde, rcondv, work, &lwork, rwork,
99  bwork, &info );
100  if( info < 0 ) {
101  info = info - 1;
102  }
103  /* Transpose output matrices */
104  LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
105  if( LAPACKE_lsame( jobvs, 'v' ) ) {
106  LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, vs_t, ldvs_t, vs, ldvs );
107  }
108  /* Release memory and exit */
109  if( LAPACKE_lsame( jobvs, 'v' ) ) {
110  LAPACKE_free( vs_t );
111  }
112 exit_level_1:
113  LAPACKE_free( a_t );
114 exit_level_0:
115  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
116  LAPACKE_xerbla( "LAPACKE_zgeesx_work", info );
117  }
118  } else {
119  info = -1;
120  LAPACKE_xerbla( "LAPACKE_zgeesx_work", info );
121  }
122  return info;
123 }
void LAPACK_zgeesx(char *jobvs, char *sort, LAPACK_Z_SELECT1 select, char *sense, lapack_int *n, lapack_complex_double *a, lapack_int *lda, lapack_int *sdim, lapack_complex_double *w, lapack_complex_double *vs, lapack_int *ldvs, double *rconde, double *rcondv, lapack_complex_double *work, lapack_int *lwork, double *rwork, lapack_logical *bwork, lapack_int *info)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACKE_free(p)
Definition: lapacke.h:113
#define lapack_complex_double
Definition: lapacke.h:90
#define MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:36
#define LAPACK_COL_MAJOR
Definition: lapacke.h:120
void LAPACKE_xerbla(const char *name, lapack_int info)
#define lapack_int
Definition: lapacke.h:47
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:123
void LAPACKE_zge_trans(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_double *in, lapack_int ldin, lapack_complex_double *out, lapack_int ldout)
Here is the call graph for this function:
Here is the caller graph for this function: