OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
lapacke_ztrsyl_work.c File Reference
#include "lapacke_utils.h"

Go to the source code of this file.

Functions

lapack_int LAPACKE_ztrsyl_work (int matrix_layout, char trana, char tranb, lapack_int isgn, 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, double *scale)

Function Documentation

◆ LAPACKE_ztrsyl_work()

lapack_int LAPACKE_ztrsyl_work ( int matrix_layout,
char trana,
char tranb,
lapack_int isgn,
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,
double * scale )

Definition at line 35 of file lapacke_ztrsyl_work.c.

41{
42 lapack_int info = 0;
43 if( matrix_layout == LAPACK_COL_MAJOR ) {
44 /* Call LAPACK function and adjust info */
45 LAPACK_ztrsyl( &trana, &tranb, &isgn, &m, &n, a, &lda, b, &ldb, c, &ldc,
46 scale, &info );
47 if( info < 0 ) {
48 info = info - 1;
49 }
50 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
51 lapack_int lda_t = MAX(1,m);
52 lapack_int ldb_t = MAX(1,n);
53 lapack_int ldc_t = MAX(1,m);
54 lapack_complex_double* a_t = NULL;
55 lapack_complex_double* b_t = NULL;
56 lapack_complex_double* c_t = NULL;
57 /* Check leading dimension(s) */
58 if( lda < m ) {
59 info = -8;
60 LAPACKE_xerbla( "LAPACKE_ztrsyl_work", info );
61 return info;
62 }
63 if( ldb < n ) {
64 info = -10;
65 LAPACKE_xerbla( "LAPACKE_ztrsyl_work", info );
66 return info;
67 }
68 if( ldc < n ) {
69 info = -12;
70 LAPACKE_xerbla( "LAPACKE_ztrsyl_work", info );
71 return info;
72 }
73 /* Allocate memory for temporary array(s) */
75 LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,m) );
76 if( a_t == NULL ) {
78 goto exit_level_0;
79 }
81 LAPACKE_malloc( sizeof(lapack_complex_double) * ldb_t * MAX(1,n) );
82 if( b_t == NULL ) {
84 goto exit_level_1;
85 }
87 LAPACKE_malloc( sizeof(lapack_complex_double) * ldc_t * MAX(1,n) );
88 if( c_t == NULL ) {
90 goto exit_level_2;
91 }
92 /* Transpose input matrices */
93 LAPACKE_zge_trans( matrix_layout, m, m, a, lda, a_t, lda_t );
94 LAPACKE_zge_trans( matrix_layout, n, n, b, ldb, b_t, ldb_t );
95 LAPACKE_zge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t );
96 /* Call LAPACK function and adjust info */
97 LAPACK_ztrsyl( &trana, &tranb, &isgn, &m, &n, a_t, &lda_t, b_t, &ldb_t,
98 c_t, &ldc_t, scale, &info );
99 if( info < 0 ) {
100 info = info - 1;
101 }
102 /* Transpose output matrices */
103 LAPACKE_zge_trans( LAPACK_COL_MAJOR, m, n, c_t, ldc_t, c, ldc );
104 /* Release memory and exit */
105 LAPACKE_free( c_t );
106exit_level_2:
107 LAPACKE_free( b_t );
108exit_level_1:
109 LAPACKE_free( a_t );
110exit_level_0:
111 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
112 LAPACKE_xerbla( "LAPACKE_ztrsyl_work", info );
113 }
114 } else {
115 info = -1;
116 LAPACKE_xerbla( "LAPACKE_ztrsyl_work", info );
117 }
118 return info;
119}
#define lapack_int
Definition lapack.h:83
#define lapack_complex_double
Definition lapack.h:63
#define LAPACK_ztrsyl(...)
Definition lapack.h:21984
#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)
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)
#define MAX(x, y)
n