LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_zgghd3_work ( int  matrix_layout,
char  compq,
char  compz,
lapack_int  n,
lapack_int  ilo,
lapack_int  ihi,
lapack_complex_double a,
lapack_int  lda,
lapack_complex_double b,
lapack_int  ldb,
lapack_complex_double q,
lapack_int  ldq,
lapack_complex_double z,
lapack_int  ldz,
lapack_complex_double work,
lapack_int  lwork 
)

Definition at line 36 of file lapacke_zgghd3_work.c.

44 {
45  lapack_int info = 0;
46  if( matrix_layout == LAPACK_COL_MAJOR ) {
47  /* Call LAPACK function and adjust info */
48  LAPACK_zgghd3( &compq, &compz, &n, &ilo, &ihi, a, &lda, b, &ldb, q,
49  &ldq, z, &ldz, work, &lwork, &info );
50  if( info < 0 ) {
51  info = info - 1;
52  }
53  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
54  lapack_int lda_t = MAX(1,n);
55  lapack_int ldb_t = MAX(1,n);
56  lapack_int ldq_t = MAX(1,n);
57  lapack_int ldz_t = MAX(1,n);
58  lapack_complex_double* a_t = NULL;
59  lapack_complex_double* b_t = NULL;
60  lapack_complex_double* q_t = NULL;
61  lapack_complex_double* z_t = NULL;
62  /* Query optimal working array(s) size if requested */
63  if( lwork == -1 ) {
64  LAPACK_zgghd3( &compq, &compz, &n, &ilo, &ihi, a, &lda, b, &ldb, q,
65  &ldq, z, &ldz, work, &lwork, &info );
66  return (info < 0) ? (info - 1) : info;
67  }
68  /* Check leading dimension(s) */
69  if( lda < n ) {
70  info = -8;
71  LAPACKE_xerbla( "LAPACKE_zgghd3_work", info );
72  return info;
73  }
74  if( ldb < n ) {
75  info = -10;
76  LAPACKE_xerbla( "LAPACKE_zgghd3_work", info );
77  return info;
78  }
79  if( ldq < n ) {
80  info = -12;
81  LAPACKE_xerbla( "LAPACKE_zgghd3_work", info );
82  return info;
83  }
84  if( ldz < n ) {
85  info = -14;
86  LAPACKE_xerbla( "LAPACKE_zgghd3_work", info );
87  return info;
88  }
89  /* Allocate memory for temporary array(s) */
90  a_t = (lapack_complex_double*)LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) );
91  if( a_t == NULL ) {
93  goto exit_level_0;
94  }
95  b_t = (lapack_complex_double*)LAPACKE_malloc( sizeof(lapack_complex_double) * ldb_t * MAX(1,n) );
96  if( b_t == NULL ) {
98  goto exit_level_1;
99  }
100  if( LAPACKE_lsame( compq, 'i' ) || LAPACKE_lsame( compq, 'v' ) ) {
101  q_t = (lapack_complex_double*)LAPACKE_malloc( sizeof(lapack_complex_double) * ldq_t * MAX(1,n) );
102  if( q_t == NULL ) {
104  goto exit_level_2;
105  }
106  }
107  if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
108  z_t = (lapack_complex_double*)LAPACKE_malloc( sizeof(lapack_complex_double) * ldz_t * MAX(1,n) );
109  if( z_t == NULL ) {
111  goto exit_level_3;
112  }
113  }
114  /* Transpose input matrices */
115  LAPACKE_zge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
116  LAPACKE_zge_trans( matrix_layout, n, n, b, ldb, b_t, ldb_t );
117  if( LAPACKE_lsame( compq, 'v' ) ) {
118  LAPACKE_zge_trans( matrix_layout, n, n, q, ldq, q_t, ldq_t );
119  }
120  if( LAPACKE_lsame( compz, 'v' ) ) {
121  LAPACKE_zge_trans( matrix_layout, n, n, z, ldz, z_t, ldz_t );
122  }
123  /* Call LAPACK function and adjust info */
124  LAPACK_zgghd3( &compq, &compz, &n, &ilo, &ihi, a_t, &lda_t, b_t, &ldb_t,
125  q_t, &ldq_t, z_t, &ldz_t, work, &lwork, &info );
126  if( info < 0 ) {
127  info = info - 1;
128  }
129  /* Transpose output matrices */
130  LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
131  LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, b_t, ldb_t, b, ldb );
132  if( LAPACKE_lsame( compq, 'i' ) || LAPACKE_lsame( compq, 'v' ) ) {
133  LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, q_t, ldq_t, q, ldq );
134  }
135  if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
136  LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, z_t, ldz_t, z, ldz );
137  }
138  /* Release memory and exit */
139  if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
140  LAPACKE_free( z_t );
141  }
142  exit_level_3:
143  if( LAPACKE_lsame( compq, 'i' ) || LAPACKE_lsame( compq, 'v' ) ) {
144  LAPACKE_free( q_t );
145  }
146  exit_level_2:
147  LAPACKE_free( b_t );
148  exit_level_1:
149  LAPACKE_free( a_t );
150  exit_level_0:
151  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
152  LAPACKE_xerbla( "LAPACKE_zgghd3_work", info );
153  }
154  } else {
155  info = -1;
156  LAPACKE_xerbla( "LAPACKE_zgghd3_work", info );
157  }
158  return info;
159 }
void LAPACK_zgghd3(char *compq, char *compz, lapack_int *n, lapack_int *ilo, lapack_int *ihi, lapack_complex_double *a, lapack_int *lda, lapack_complex_double *b, lapack_int *ldb, lapack_complex_double *q, lapack_int *ldq, lapack_complex_double *z, lapack_int *ldz, lapack_complex_double *work, lapack_int *lwork, lapack_int *info)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define lapack_complex_double
Definition: lapacke.h:90
#define MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACKE_free(p)
Definition: lapacke.h:113
#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: