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

Go to the source code of this file.

Functions

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)

Function Documentation

◆ 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 35 of file lapacke_dtgsyl_work.c.

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