LAPACK  3.9.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_cgbrfsx_work()

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

Definition at line 35 of file lapacke_cgbrfsx_work.c.

50 {
51  lapack_int info = 0;
52  if( matrix_layout == LAPACK_COL_MAJOR ) {
53  /* Call LAPACK function and adjust info */
54  LAPACK_cgbrfsx( &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_float* ab_t = NULL;
67  lapack_complex_float* afb_t = NULL;
68  lapack_complex_float* b_t = NULL;
69  lapack_complex_float* x_t = NULL;
70  float* err_bnds_norm_t = NULL;
71  float* err_bnds_comp_t = NULL;
72  /* Check leading dimension(s) */
73  if( ldab < n ) {
74  info = -9;
75  LAPACKE_xerbla( "LAPACKE_cgbrfsx_work", info );
76  return info;
77  }
78  if( ldafb < n ) {
79  info = -11;
80  LAPACKE_xerbla( "LAPACKE_cgbrfsx_work", info );
81  return info;
82  }
83  if( ldb < nrhs ) {
84  info = -16;
85  LAPACKE_xerbla( "LAPACKE_cgbrfsx_work", info );
86  return info;
87  }
88  if( ldx < nrhs ) {
89  info = -18;
90  LAPACKE_xerbla( "LAPACKE_cgbrfsx_work", info );
91  return info;
92  }
93  /* Allocate memory for temporary array(s) */
94  ab_t = (lapack_complex_float*)
95  LAPACKE_malloc( sizeof(lapack_complex_float) * ldab_t * MAX(1,n) );
96  if( ab_t == NULL ) {
98  goto exit_level_0;
99  }
100  afb_t = (lapack_complex_float*)
101  LAPACKE_malloc( sizeof(lapack_complex_float) * ldafb_t * MAX(1,n) );
102  if( afb_t == NULL ) {
104  goto exit_level_1;
105  }
106  b_t = (lapack_complex_float*)
108  ldb_t * MAX(1,nrhs) );
109  if( b_t == NULL ) {
111  goto exit_level_2;
112  }
113  x_t = (lapack_complex_float*)
115  ldx_t * MAX(1,nrhs) );
116  if( x_t == NULL ) {
118  goto exit_level_3;
119  }
120  err_bnds_norm_t = (float*)
121  LAPACKE_malloc( sizeof(float) * nrhs * MAX(1,n_err_bnds) );
122  if( err_bnds_norm_t == NULL ) {
124  goto exit_level_4;
125  }
126  err_bnds_comp_t = (float*)
127  LAPACKE_malloc( sizeof(float) * nrhs * MAX(1,n_err_bnds) );
128  if( err_bnds_comp_t == NULL ) {
130  goto exit_level_5;
131  }
132  /* Transpose input matrices */
133  LAPACKE_cgb_trans( matrix_layout, n, n, kl, ku, ab, ldab, ab_t, ldab_t );
134  LAPACKE_cgb_trans( matrix_layout, n, n, kl, kl+ku, afb, ldafb, afb_t,
135  ldafb_t );
136  LAPACKE_cge_trans( matrix_layout, n, nrhs, b, ldb, b_t, ldb_t );
137  LAPACKE_cge_trans( matrix_layout, n, nrhs, x, ldx, x_t, ldx_t );
138  /* Call LAPACK function and adjust info */
139  LAPACK_cgbrfsx( &trans, &equed, &n, &kl, &ku, &nrhs, ab_t, &ldab_t,
140  afb_t, &ldafb_t, ipiv, r, c, b_t, &ldb_t, x_t, &ldx_t,
141  rcond, berr, &n_err_bnds, err_bnds_norm_t,
142  err_bnds_comp_t, &nparams, params, work, rwork, &info );
143  if( info < 0 ) {
144  info = info - 1;
145  }
146  /* Transpose output matrices */
147  LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, nrhs, x_t, ldx_t, x, ldx );
148  LAPACKE_sge_trans( LAPACK_COL_MAJOR, nrhs, n_err_bnds, err_bnds_norm_t,
149  nrhs, err_bnds_norm, nrhs );
150  LAPACKE_sge_trans( LAPACK_COL_MAJOR, nrhs, n_err_bnds, err_bnds_comp_t,
151  nrhs, err_bnds_comp, nrhs );
152  /* Release memory and exit */
153  LAPACKE_free( err_bnds_comp_t );
154 exit_level_5:
155  LAPACKE_free( err_bnds_norm_t );
156 exit_level_4:
157  LAPACKE_free( x_t );
158 exit_level_3:
159  LAPACKE_free( b_t );
160 exit_level_2:
161  LAPACKE_free( afb_t );
162 exit_level_1:
163  LAPACKE_free( ab_t );
164 exit_level_0:
165  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
166  LAPACKE_xerbla( "LAPACKE_cgbrfsx_work", info );
167  }
168  } else {
169  info = -1;
170  LAPACKE_xerbla( "LAPACKE_cgbrfsx_work", info );
171  }
172  return info;
173 }
#define lapack_int
Definition: lapack.h:83
void LAPACK_cgbrfsx(char const *trans, char const *equed, lapack_int const *n, lapack_int const *kl, lapack_int const *ku, lapack_int const *nrhs, lapack_complex_float const *AB, lapack_int const *ldab, lapack_complex_float const *AFB, lapack_int const *ldafb, lapack_int const *ipiv, float *R, float *C, lapack_complex_float const *B, lapack_int const *ldb, lapack_complex_float *X, lapack_int const *ldx, float *rcond, float *berr, lapack_int const *n_err_bnds, float *err_bnds_norm, float *err_bnds_comp, lapack_int const *nparams, float *params, lapack_complex_float *work, float *rwork, lapack_int *info)
#define lapack_complex_float
Definition: lapack.h:45
#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_cgb_trans(int matrix_layout, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const lapack_complex_float *in, lapack_int ldin, lapack_complex_float *out, lapack_int ldout)
void LAPACKE_sge_trans(int matrix_layout, lapack_int m, lapack_int n, const float *in, lapack_int ldin, float *out, lapack_int ldout)
#define MAX(x, y)
Definition: lapacke_utils.h:46
void LAPACKE_cge_trans(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_float *in, lapack_int ldin, lapack_complex_float *out, lapack_int ldout)
Here is the call graph for this function:
Here is the caller graph for this function: