LAPACK  3.7.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dtgsyl_work()

lapack_int LAPACKE_dtgsyl_work ( int  matrix_layout,
char  trans,
lapack_int  ijob,
lapack_int  m,
lapack_int  n,
const double *  a,
lapack_int  lda,
const double *  b,
lapack_int  ldb,
double *  c,
lapack_int  ldc,
const double *  d,
lapack_int  ldd,
const double *  e,
lapack_int  lde,
double *  f,
lapack_int  ldf,
double *  scale,
double *  dif,
double *  work,
lapack_int  lwork,
lapack_int iwork 
)

Definition at line 36 of file lapacke_dtgsyl_work.c.

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