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

Go to the source code of this file.

Functions

lapack_int LAPACKE_zgtrfs_work (int matrix_layout, char trans, lapack_int n, lapack_int nrhs, const lapack_complex_double *dl, const lapack_complex_double *d, const lapack_complex_double *du, const lapack_complex_double *dlf, const lapack_complex_double *df, const lapack_complex_double *duf, const lapack_complex_double *du2, const lapack_int *ipiv, const lapack_complex_double *b, lapack_int ldb, lapack_complex_double *x, lapack_int ldx, double *ferr, double *berr, lapack_complex_double *work, double *rwork)

Function Documentation

◆ LAPACKE_zgtrfs_work()

lapack_int LAPACKE_zgtrfs_work ( int matrix_layout,
char trans,
lapack_int n,
lapack_int nrhs,
const lapack_complex_double * dl,
const lapack_complex_double * d,
const lapack_complex_double * du,
const lapack_complex_double * dlf,
const lapack_complex_double * df,
const lapack_complex_double * duf,
const lapack_complex_double * du2,
const lapack_int * ipiv,
const lapack_complex_double * b,
lapack_int ldb,
lapack_complex_double * x,
lapack_int ldx,
double * ferr,
double * berr,
lapack_complex_double * work,
double * rwork )

Definition at line 35 of file lapacke_zgtrfs_work.c.

49{
50 lapack_int info = 0;
51 if( matrix_layout == LAPACK_COL_MAJOR ) {
52 /* Call LAPACK function and adjust info */
53 LAPACK_zgtrfs( &trans, &n, &nrhs, dl, d, du, dlf, df, duf, du2, ipiv, b,
54 &ldb, x, &ldx, ferr, berr, work, rwork, &info );
55 if( info < 0 ) {
56 info = info - 1;
57 }
58 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
59 lapack_int ldb_t = MAX(1,n);
60 lapack_int ldx_t = MAX(1,n);
61 lapack_complex_double* b_t = NULL;
62 lapack_complex_double* x_t = NULL;
63 /* Check leading dimension(s) */
64 if( ldb < nrhs ) {
65 info = -14;
66 LAPACKE_xerbla( "LAPACKE_zgtrfs_work", info );
67 return info;
68 }
69 if( ldx < nrhs ) {
70 info = -16;
71 LAPACKE_xerbla( "LAPACKE_zgtrfs_work", info );
72 return info;
73 }
74 /* Allocate memory for temporary array(s) */
77 ldb_t * MAX(1,nrhs) );
78 if( b_t == NULL ) {
80 goto exit_level_0;
81 }
84 ldx_t * MAX(1,nrhs) );
85 if( x_t == NULL ) {
87 goto exit_level_1;
88 }
89 /* Transpose input matrices */
90 LAPACKE_zge_trans( matrix_layout, n, nrhs, b, ldb, b_t, ldb_t );
91 LAPACKE_zge_trans( matrix_layout, n, nrhs, x, ldx, x_t, ldx_t );
92 /* Call LAPACK function and adjust info */
93 LAPACK_zgtrfs( &trans, &n, &nrhs, dl, d, du, dlf, df, duf, du2, ipiv,
94 b_t, &ldb_t, x_t, &ldx_t, ferr, berr, work, rwork,
95 &info );
96 if( info < 0 ) {
97 info = info - 1;
98 }
99 /* Transpose output matrices */
100 LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, x_t, ldx_t, x, ldx );
101 /* Release memory and exit */
102 LAPACKE_free( x_t );
103exit_level_1:
104 LAPACKE_free( b_t );
105exit_level_0:
106 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
107 LAPACKE_xerbla( "LAPACKE_zgtrfs_work", info );
108 }
109 } else {
110 info = -1;
111 LAPACKE_xerbla( "LAPACKE_zgtrfs_work", info );
112 }
113 return info;
114}
#define lapack_int
Definition lapack.h:83
#define LAPACK_zgtrfs(...)
Definition lapack.h:5847
#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)
#define MAX(x, y)
n