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

Go to the source code of this file.

Functions

lapack_int LAPACKE_zgbrfsx_work (int matrix_layout, char trans, char equed, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const lapack_complex_double *ab, lapack_int ldab, const lapack_complex_double *afb, lapack_int ldafb, const lapack_int *ipiv, const double *r, const double *c, const lapack_complex_double *b, lapack_int ldb, lapack_complex_double *x, lapack_int ldx, double *rcond, double *berr, lapack_int n_err_bnds, double *err_bnds_norm, double *err_bnds_comp, lapack_int nparams, double *params, lapack_complex_double *work, double *rwork)

Function Documentation

◆ LAPACKE_zgbrfsx_work()

lapack_int LAPACKE_zgbrfsx_work ( int matrix_layout,
char trans,
char equed,
lapack_int n,
lapack_int kl,
lapack_int ku,
lapack_int nrhs,
const lapack_complex_double * ab,
lapack_int ldab,
const lapack_complex_double * afb,
lapack_int ldafb,
const lapack_int * ipiv,
const double * r,
const double * c,
const lapack_complex_double * b,
lapack_int ldb,
lapack_complex_double * x,
lapack_int ldx,
double * rcond,
double * berr,
lapack_int n_err_bnds,
double * err_bnds_norm,
double * err_bnds_comp,
lapack_int nparams,
double * params,
lapack_complex_double * work,
double * rwork )

Definition at line 35 of file lapacke_zgbrfsx_work.c.

50{
51 lapack_int info = 0;
52 if( matrix_layout == LAPACK_COL_MAJOR ) {
53 /* Call LAPACK function and adjust info */
54 LAPACK_zgbrfsx( &trans, &equed, &n, &kl, &ku, &nrhs, ab, &ldab, afb,
55 &ldafb, ipiv, r, c, b, &ldb, x, &ldx, rcond, berr,
56 &n_err_bnds, err_bnds_norm, err_bnds_comp, &nparams,
57 params, work, rwork, &info );
58 if( info < 0 ) {
59 info = info - 1;
60 }
61 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
62 lapack_int ldab_t = MAX(1,kl+ku+1);
63 lapack_int ldafb_t = MAX(1,2*kl+ku+1);
64 lapack_int ldb_t = MAX(1,n);
65 lapack_int ldx_t = MAX(1,n);
66 lapack_complex_double* ab_t = NULL;
67 lapack_complex_double* afb_t = NULL;
68 lapack_complex_double* b_t = NULL;
69 lapack_complex_double* x_t = NULL;
70 double* err_bnds_norm_t = NULL;
71 double* err_bnds_comp_t = NULL;
72 /* Check leading dimension(s) */
73 if( ldab < n ) {
74 info = -9;
75 LAPACKE_xerbla( "LAPACKE_zgbrfsx_work", info );
76 return info;
77 }
78 if( ldafb < n ) {
79 info = -11;
80 LAPACKE_xerbla( "LAPACKE_zgbrfsx_work", info );
81 return info;
82 }
83 if( ldb < nrhs ) {
84 info = -16;
85 LAPACKE_xerbla( "LAPACKE_zgbrfsx_work", info );
86 return info;
87 }
88 if( ldx < nrhs ) {
89 info = -18;
90 LAPACKE_xerbla( "LAPACKE_zgbrfsx_work", info );
91 return info;
92 }
93 /* Allocate memory for temporary array(s) */
94 ab_t = (lapack_complex_double*)
95 LAPACKE_malloc( sizeof(lapack_complex_double) * ldab_t * MAX(1,n) );
96 if( ab_t == NULL ) {
98 goto exit_level_0;
99 }
100 afb_t = (lapack_complex_double*)
102 ldafb_t * MAX(1,n) );
103 if( afb_t == NULL ) {
105 goto exit_level_1;
106 }
107 b_t = (lapack_complex_double*)
109 ldb_t * MAX(1,nrhs) );
110 if( b_t == NULL ) {
112 goto exit_level_2;
113 }
114 x_t = (lapack_complex_double*)
116 ldx_t * MAX(1,nrhs) );
117 if( x_t == NULL ) {
119 goto exit_level_3;
120 }
121 err_bnds_norm_t = (double*)
122 LAPACKE_malloc( sizeof(double) * nrhs * MAX(1,n_err_bnds) );
123 if( err_bnds_norm_t == NULL ) {
125 goto exit_level_4;
126 }
127 err_bnds_comp_t = (double*)
128 LAPACKE_malloc( sizeof(double) * nrhs * MAX(1,n_err_bnds) );
129 if( err_bnds_comp_t == NULL ) {
131 goto exit_level_5;
132 }
133 /* Transpose input matrices */
134 LAPACKE_zgb_trans( matrix_layout, n, n, kl, ku, ab, ldab, ab_t, ldab_t );
135 LAPACKE_zgb_trans( matrix_layout, n, n, kl, kl+ku, afb, ldafb, afb_t,
136 ldafb_t );
137 LAPACKE_zge_trans( matrix_layout, n, nrhs, b, ldb, b_t, ldb_t );
138 LAPACKE_zge_trans( matrix_layout, n, nrhs, x, ldx, x_t, ldx_t );
139 /* Call LAPACK function and adjust info */
140 LAPACK_zgbrfsx( &trans, &equed, &n, &kl, &ku, &nrhs, ab_t, &ldab_t,
141 afb_t, &ldafb_t, ipiv, r, c, b_t, &ldb_t, x_t, &ldx_t,
142 rcond, berr, &n_err_bnds, err_bnds_norm_t,
143 err_bnds_comp_t, &nparams, params, work, rwork, &info );
144 if( info < 0 ) {
145 info = info - 1;
146 }
147 /* Transpose output matrices */
148 LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, x_t, ldx_t, x, ldx );
149 LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrhs, n_err_bnds, err_bnds_norm_t,
150 nrhs, err_bnds_norm, nrhs );
151 LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrhs, n_err_bnds, err_bnds_comp_t,
152 nrhs, err_bnds_comp, nrhs );
153 /* Release memory and exit */
154 LAPACKE_free( err_bnds_comp_t );
155exit_level_5:
156 LAPACKE_free( err_bnds_norm_t );
157exit_level_4:
158 LAPACKE_free( x_t );
159exit_level_3:
160 LAPACKE_free( b_t );
161exit_level_2:
162 LAPACKE_free( afb_t );
163exit_level_1:
164 LAPACKE_free( ab_t );
165exit_level_0:
166 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
167 LAPACKE_xerbla( "LAPACKE_zgbrfsx_work", info );
168 }
169 } else {
170 info = -1;
171 LAPACKE_xerbla( "LAPACKE_zgbrfsx_work", info );
172 }
173 return info;
174}
#define lapack_int
Definition lapack.h:83
#define LAPACK_zgbrfsx(...)
Definition lapack.h:919
#define lapack_complex_double
Definition lapack.h:63
#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)
void LAPACKE_zgb_trans(int matrix_layout, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const lapack_complex_double *in, lapack_int ldin, lapack_complex_double *out, lapack_int ldout)
#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