LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dtrsyl_work()

lapack_int LAPACKE_dtrsyl_work ( int  matrix_layout,
char  trana,
char  tranb,
lapack_int  isgn,
lapack_int  m,
lapack_int  n,
const double *  a,
lapack_int  lda,
const double *  b,
lapack_int  ldb,
double *  c,
lapack_int  ldc,
double *  scale 
)

Definition at line 35 of file lapacke_dtrsyl_work.c.

40 {
41  lapack_int info = 0;
42  if( matrix_layout == LAPACK_COL_MAJOR ) {
43  /* Call LAPACK function and adjust info */
44  LAPACK_dtrsyl( &trana, &tranb, &isgn, &m, &n, a, &lda, b, &ldb, c, &ldc,
45  scale, &info );
46  if( info < 0 ) {
47  info = info - 1;
48  }
49  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
50  lapack_int lda_t = MAX(1,m);
51  lapack_int ldb_t = MAX(1,n);
52  lapack_int ldc_t = MAX(1,m);
53  double* a_t = NULL;
54  double* b_t = NULL;
55  double* c_t = NULL;
56  /* Check leading dimension(s) */
57  if( lda < m ) {
58  info = -8;
59  LAPACKE_xerbla( "LAPACKE_dtrsyl_work", info );
60  return info;
61  }
62  if( ldb < n ) {
63  info = -10;
64  LAPACKE_xerbla( "LAPACKE_dtrsyl_work", info );
65  return info;
66  }
67  if( ldc < n ) {
68  info = -12;
69  LAPACKE_xerbla( "LAPACKE_dtrsyl_work", info );
70  return info;
71  }
72  /* Allocate memory for temporary array(s) */
73  a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,m) );
74  if( a_t == NULL ) {
76  goto exit_level_0;
77  }
78  b_t = (double*)LAPACKE_malloc( sizeof(double) * ldb_t * MAX(1,n) );
79  if( b_t == NULL ) {
81  goto exit_level_1;
82  }
83  c_t = (double*)LAPACKE_malloc( sizeof(double) * ldc_t * MAX(1,n) );
84  if( c_t == NULL ) {
86  goto exit_level_2;
87  }
88  /* Transpose input matrices */
89  LAPACKE_dge_trans( matrix_layout, m, m, a, lda, a_t, lda_t );
90  LAPACKE_dge_trans( matrix_layout, n, n, b, ldb, b_t, ldb_t );
91  LAPACKE_dge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t );
92  /* Call LAPACK function and adjust info */
93  LAPACK_dtrsyl( &trana, &tranb, &isgn, &m, &n, a_t, &lda_t, b_t, &ldb_t,
94  c_t, &ldc_t, scale, &info );
95  if( info < 0 ) {
96  info = info - 1;
97  }
98  /* Transpose output matrices */
99  LAPACKE_dge_trans( LAPACK_COL_MAJOR, m, n, c_t, ldc_t, c, ldc );
100  /* Release memory and exit */
101  LAPACKE_free( c_t );
102 exit_level_2:
103  LAPACKE_free( b_t );
104 exit_level_1:
105  LAPACKE_free( a_t );
106 exit_level_0:
107  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
108  LAPACKE_xerbla( "LAPACKE_dtrsyl_work", info );
109  }
110  } else {
111  info = -1;
112  LAPACKE_xerbla( "LAPACKE_dtrsyl_work", info );
113  }
114  return info;
115 }
#define LAPACK_dtrsyl(...)
Definition: lapack.h:21946
#define lapack_int
Definition: lapack.h:83
#define LAPACK_COL_MAJOR
Definition: lapacke.h:53
#define LAPACKE_free(p)
Definition: lapacke.h:46
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:52
#define LAPACKE_malloc(size)
Definition: lapacke.h:43
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:56
void LAPACKE_xerbla(const char *name, lapack_int info)
#define MAX(x, y)
Definition: lapacke_utils.h:46
void LAPACKE_dge_trans(int matrix_layout, lapack_int m, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
Here is the call graph for this function:
Here is the caller graph for this function: