LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_cgbsvxx_work()

lapack_int LAPACKE_cgbsvxx_work ( int  matrix_layout,
char  fact,
char  trans,
lapack_int  n,
lapack_int  kl,
lapack_int  ku,
lapack_int  nrhs,
lapack_complex_float ab,
lapack_int  ldab,
lapack_complex_float afb,
lapack_int  ldafb,
lapack_int ipiv,
char *  equed,
float *  r,
float *  c,
lapack_complex_float b,
lapack_int  ldb,
lapack_complex_float x,
lapack_int  ldx,
float *  rcond,
float *  rpvgrw,
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_cgbsvxx_work.c.

48 {
49  lapack_int info = 0;
50  if( matrix_layout == LAPACK_COL_MAJOR ) {
51  /* Call LAPACK function and adjust info */
52  LAPACK_cgbsvxx( &fact, &trans, &n, &kl, &ku, &nrhs, ab, &ldab, afb,
53  &ldafb, ipiv, equed, r, c, b, &ldb, x, &ldx, rcond,
54  rpvgrw, berr, &n_err_bnds, err_bnds_norm, err_bnds_comp,
55  &nparams, params, work, rwork, &info );
56  if( info < 0 ) {
57  info = info - 1;
58  }
59  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
60  lapack_int ldab_t = MAX(1,kl+ku+1);
61  lapack_int ldafb_t = MAX(1,2*kl+ku+1);
62  lapack_int ldb_t = MAX(1,n);
63  lapack_int ldx_t = MAX(1,n);
64  lapack_complex_float* ab_t = NULL;
65  lapack_complex_float* afb_t = NULL;
66  lapack_complex_float* b_t = NULL;
67  lapack_complex_float* x_t = NULL;
68  float* err_bnds_norm_t = NULL;
69  float* err_bnds_comp_t = NULL;
70  /* Check leading dimension(s) */
71  if( ldab < n ) {
72  info = -9;
73  LAPACKE_xerbla( "LAPACKE_cgbsvxx_work", info );
74  return info;
75  }
76  if( ldafb < n ) {
77  info = -11;
78  LAPACKE_xerbla( "LAPACKE_cgbsvxx_work", info );
79  return info;
80  }
81  if( ldb < nrhs ) {
82  info = -17;
83  LAPACKE_xerbla( "LAPACKE_cgbsvxx_work", info );
84  return info;
85  }
86  if( ldx < nrhs ) {
87  info = -19;
88  LAPACKE_xerbla( "LAPACKE_cgbsvxx_work", info );
89  return info;
90  }
91  /* Allocate memory for temporary array(s) */
92  ab_t = (lapack_complex_float*)
93  LAPACKE_malloc( sizeof(lapack_complex_float) * ldab_t * MAX(1,n) );
94  if( ab_t == NULL ) {
96  goto exit_level_0;
97  }
98  afb_t = (lapack_complex_float*)
99  LAPACKE_malloc( sizeof(lapack_complex_float) * ldafb_t * MAX(1,n) );
100  if( afb_t == NULL ) {
102  goto exit_level_1;
103  }
104  b_t = (lapack_complex_float*)
106  ldb_t * MAX(1,nrhs) );
107  if( b_t == NULL ) {
109  goto exit_level_2;
110  }
111  x_t = (lapack_complex_float*)
113  ldx_t * MAX(1,nrhs) );
114  if( x_t == NULL ) {
116  goto exit_level_3;
117  }
118  err_bnds_norm_t = (float*)
119  LAPACKE_malloc( sizeof(float) * nrhs * MAX(1,n_err_bnds) );
120  if( err_bnds_norm_t == NULL ) {
122  goto exit_level_4;
123  }
124  err_bnds_comp_t = (float*)
125  LAPACKE_malloc( sizeof(float) * nrhs * MAX(1,n_err_bnds) );
126  if( err_bnds_comp_t == NULL ) {
128  goto exit_level_5;
129  }
130  /* Transpose input matrices */
131  LAPACKE_cgb_trans( matrix_layout, n, n, kl, ku, ab, ldab, ab_t, ldab_t );
132  if( LAPACKE_lsame( fact, 'f' ) ) {
133  LAPACKE_cgb_trans( matrix_layout, n, n, kl, kl+ku, afb, ldafb, afb_t,
134  ldafb_t );
135  }
136  LAPACKE_cge_trans( matrix_layout, n, nrhs, b, ldb, b_t, ldb_t );
137  /* Call LAPACK function and adjust info */
138  LAPACK_cgbsvxx( &fact, &trans, &n, &kl, &ku, &nrhs, ab_t, &ldab_t,
139  afb_t, &ldafb_t, ipiv, equed, r, c, b_t, &ldb_t, x_t,
140  &ldx_t, rcond, rpvgrw, berr, &n_err_bnds,
141  err_bnds_norm_t, err_bnds_comp_t, &nparams, params,
142  work, rwork, &info );
143  if( info < 0 ) {
144  info = info - 1;
145  }
146  /* Transpose output matrices */
147  if( LAPACKE_lsame( fact, 'e' ) && ( LAPACKE_lsame( *equed, 'b' ) ||
148  LAPACKE_lsame( *equed, 'c' ) || LAPACKE_lsame( *equed, 'r' ) ) ) {
149  LAPACKE_cgb_trans( LAPACK_COL_MAJOR, n, n, kl, ku, ab_t, ldab_t, ab,
150  ldab );
151  }
152  if( LAPACKE_lsame( fact, 'e' ) || LAPACKE_lsame( fact, 'n' ) ) {
153  LAPACKE_cgb_trans( LAPACK_COL_MAJOR, n, n, kl, kl+ku, afb_t,
154  ldafb_t, afb, ldafb );
155  }
156  if( LAPACKE_lsame( fact, 'f' ) && ( LAPACKE_lsame( *equed, 'b' ) ||
157  LAPACKE_lsame( *equed, 'c' ) || LAPACKE_lsame( *equed, 'r' ) ) ) {
158  LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, nrhs, b_t, ldb_t, b, ldb );
159  }
160  LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, nrhs, x_t, ldx_t, x, ldx );
161  LAPACKE_sge_trans( LAPACK_COL_MAJOR, nrhs, n_err_bnds, err_bnds_norm_t,
162  nrhs, err_bnds_norm, n_err_bnds );
163  LAPACKE_sge_trans( LAPACK_COL_MAJOR, nrhs, n_err_bnds, err_bnds_comp_t,
164  nrhs, err_bnds_comp, n_err_bnds );
165  /* Release memory and exit */
166  LAPACKE_free( err_bnds_comp_t );
167 exit_level_5:
168  LAPACKE_free( err_bnds_norm_t );
169 exit_level_4:
170  LAPACKE_free( x_t );
171 exit_level_3:
172  LAPACKE_free( b_t );
173 exit_level_2:
174  LAPACKE_free( afb_t );
175 exit_level_1:
176  LAPACKE_free( ab_t );
177 exit_level_0:
178  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
179  LAPACKE_xerbla( "LAPACKE_cgbsvxx_work", info );
180  }
181  } else {
182  info = -1;
183  LAPACKE_xerbla( "LAPACKE_cgbsvxx_work", info );
184  }
185  return info;
186 }
#define lapack_int
Definition: lapack.h:83
#define LAPACK_cgbsvxx(...)
Definition: lapack.h:1085
#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
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
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: