LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_ztgsyl_work ( int  matrix_layout,
char  trans,
lapack_int  ijob,
lapack_int  m,
lapack_int  n,
const lapack_complex_double a,
lapack_int  lda,
const lapack_complex_double b,
lapack_int  ldb,
lapack_complex_double c,
lapack_int  ldc,
const lapack_complex_double d,
lapack_int  ldd,
const lapack_complex_double e,
lapack_int  lde,
lapack_complex_double f,
lapack_int  ldf,
double *  scale,
double *  dif,
lapack_complex_double work,
lapack_int  lwork,
lapack_int iwork 
)

Definition at line 36 of file lapacke_ztgsyl_work.c.

47 {
48  lapack_int info = 0;
49  if( matrix_layout == LAPACK_COL_MAJOR ) {
50  /* Call LAPACK function and adjust info */
51  LAPACK_ztgsyl( &trans, &ijob, &m, &n, a, &lda, b, &ldb, c, &ldc, d,
52  &ldd, e, &lde, f, &ldf, scale, dif, work, &lwork, iwork,
53  &info );
54  if( info < 0 ) {
55  info = info - 1;
56  }
57  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
58  lapack_int lda_t = MAX(1,m);
59  lapack_int ldb_t = MAX(1,n);
60  lapack_int ldc_t = MAX(1,m);
61  lapack_int ldd_t = MAX(1,m);
62  lapack_int lde_t = MAX(1,n);
63  lapack_int ldf_t = MAX(1,m);
64  lapack_complex_double* a_t = NULL;
65  lapack_complex_double* b_t = NULL;
66  lapack_complex_double* c_t = NULL;
67  lapack_complex_double* d_t = NULL;
68  lapack_complex_double* e_t = NULL;
69  lapack_complex_double* f_t = NULL;
70  /* Check leading dimension(s) */
71  if( lda < m ) {
72  info = -7;
73  LAPACKE_xerbla( "LAPACKE_ztgsyl_work", info );
74  return info;
75  }
76  if( ldb < n ) {
77  info = -9;
78  LAPACKE_xerbla( "LAPACKE_ztgsyl_work", info );
79  return info;
80  }
81  if( ldc < n ) {
82  info = -11;
83  LAPACKE_xerbla( "LAPACKE_ztgsyl_work", info );
84  return info;
85  }
86  if( ldd < m ) {
87  info = -13;
88  LAPACKE_xerbla( "LAPACKE_ztgsyl_work", info );
89  return info;
90  }
91  if( lde < n ) {
92  info = -15;
93  LAPACKE_xerbla( "LAPACKE_ztgsyl_work", info );
94  return info;
95  }
96  if( ldf < n ) {
97  info = -17;
98  LAPACKE_xerbla( "LAPACKE_ztgsyl_work", info );
99  return info;
100  }
101  /* Query optimal working array(s) size if requested */
102  if( lwork == -1 ) {
103  LAPACK_ztgsyl( &trans, &ijob, &m, &n, a, &lda_t, b, &ldb_t, c,
104  &ldc_t, d, &ldd_t, e, &lde_t, f, &ldf_t, scale, dif,
105  work, &lwork, iwork, &info );
106  return (info < 0) ? (info - 1) : info;
107  }
108  /* Allocate memory for temporary array(s) */
109  a_t = (lapack_complex_double*)
110  LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,m) );
111  if( a_t == NULL ) {
113  goto exit_level_0;
114  }
115  b_t = (lapack_complex_double*)
116  LAPACKE_malloc( sizeof(lapack_complex_double) * ldb_t * MAX(1,n) );
117  if( b_t == NULL ) {
119  goto exit_level_1;
120  }
121  c_t = (lapack_complex_double*)
122  LAPACKE_malloc( sizeof(lapack_complex_double) * ldc_t * MAX(1,n) );
123  if( c_t == NULL ) {
125  goto exit_level_2;
126  }
127  d_t = (lapack_complex_double*)
128  LAPACKE_malloc( sizeof(lapack_complex_double) * ldd_t * MAX(1,m) );
129  if( d_t == NULL ) {
131  goto exit_level_3;
132  }
133  e_t = (lapack_complex_double*)
134  LAPACKE_malloc( sizeof(lapack_complex_double) * lde_t * MAX(1,n) );
135  if( e_t == NULL ) {
137  goto exit_level_4;
138  }
139  f_t = (lapack_complex_double*)
140  LAPACKE_malloc( sizeof(lapack_complex_double) * ldf_t * MAX(1,n) );
141  if( f_t == NULL ) {
143  goto exit_level_5;
144  }
145  /* Transpose input matrices */
146  LAPACKE_zge_trans( matrix_layout, m, m, a, lda, a_t, lda_t );
147  LAPACKE_zge_trans( matrix_layout, n, n, b, ldb, b_t, ldb_t );
148  LAPACKE_zge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t );
149  LAPACKE_zge_trans( matrix_layout, m, m, d, ldd, d_t, ldd_t );
150  LAPACKE_zge_trans( matrix_layout, n, n, e, lde, e_t, lde_t );
151  LAPACKE_zge_trans( matrix_layout, m, n, f, ldf, f_t, ldf_t );
152  /* Call LAPACK function and adjust info */
153  LAPACK_ztgsyl( &trans, &ijob, &m, &n, a_t, &lda_t, b_t, &ldb_t, c_t,
154  &ldc_t, d_t, &ldd_t, e_t, &lde_t, f_t, &ldf_t, scale,
155  dif, work, &lwork, iwork, &info );
156  if( info < 0 ) {
157  info = info - 1;
158  }
159  /* Transpose output matrices */
160  LAPACKE_zge_trans( LAPACK_COL_MAJOR, m, n, c_t, ldc_t, c, ldc );
161  LAPACKE_zge_trans( LAPACK_COL_MAJOR, m, n, f_t, ldf_t, f, ldf );
162  /* Release memory and exit */
163  LAPACKE_free( f_t );
164 exit_level_5:
165  LAPACKE_free( e_t );
166 exit_level_4:
167  LAPACKE_free( d_t );
168 exit_level_3:
169  LAPACKE_free( c_t );
170 exit_level_2:
171  LAPACKE_free( b_t );
172 exit_level_1:
173  LAPACKE_free( a_t );
174 exit_level_0:
175  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
176  LAPACKE_xerbla( "LAPACKE_ztgsyl_work", info );
177  }
178  } else {
179  info = -1;
180  LAPACKE_xerbla( "LAPACKE_ztgsyl_work", info );
181  }
182  return info;
183 }
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define lapack_complex_double
Definition: lapacke.h:90
logical function lde(RI, RJ, LR)
Definition: dblat2.f:2945
void LAPACK_ztgsyl(char *trans, lapack_int *ijob, lapack_int *m, lapack_int *n, const lapack_complex_double *a, lapack_int *lda, const lapack_complex_double *b, lapack_int *ldb, lapack_complex_double *c, lapack_int *ldc, const lapack_complex_double *d, lapack_int *ldd, const lapack_complex_double *e, lapack_int *lde, lapack_complex_double *f, lapack_int *ldf, double *scale, double *dif, lapack_complex_double *work, lapack_int *lwork, lapack_int *iwork, lapack_int *info)
#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
#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: