LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ LAPACKE_zgtsvx_work()

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

Definition at line 35 of file lapacke_zgtsvx_work.c.

48{
49 lapack_int info = 0;
50 if( matrix_layout == LAPACK_COL_MAJOR ) {
51 /* Call LAPACK function and adjust info */
52 LAPACK_zgtsvx( &fact, &trans, &n, &nrhs, dl, d, du, dlf, df, duf, du2,
53 ipiv, b, &ldb, x, &ldx, rcond, ferr, berr, work, rwork,
54 &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 = -15;
66 LAPACKE_xerbla( "LAPACKE_zgtsvx_work", info );
67 return info;
68 }
69 if( ldx < nrhs ) {
70 info = -17;
71 LAPACKE_xerbla( "LAPACKE_zgtsvx_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 /* Call LAPACK function and adjust info */
92 LAPACK_zgtsvx( &fact, &trans, &n, &nrhs, dl, d, du, dlf, df, duf, du2,
93 ipiv, b_t, &ldb_t, x_t, &ldx_t, rcond, ferr, berr, work,
94 rwork, &info );
95 if( info < 0 ) {
96 info = info - 1;
97 }
98 /* Transpose output matrices */
99 LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, x_t, ldx_t, x, ldx );
100 /* Release memory and exit */
101 LAPACKE_free( x_t );
102exit_level_1:
103 LAPACKE_free( b_t );
104exit_level_0:
105 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
106 LAPACKE_xerbla( "LAPACKE_zgtsvx_work", info );
107 }
108 } else {
109 info = -1;
110 LAPACKE_xerbla( "LAPACKE_zgtsvx_work", info );
111 }
112 return info;
113}
#define lapack_int
Definition: lapack.h:87
#define LAPACK_zgtsvx(...)
Definition: lapack.h:6015
#define lapack_complex_double
Definition: lapack.h:64
#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)
Definition: lapacke_utils.h:46
Here is the call graph for this function:
Here is the caller graph for this function: