LAPACK  3.7.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_zgttrs_work()

lapack_int LAPACKE_zgttrs_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 du2,
const lapack_int ipiv,
lapack_complex_double b,
lapack_int  ldb 
)

Definition at line 36 of file lapacke_zgttrs_work.c.

44 {
45  lapack_int info = 0;
46  if( matrix_layout == LAPACK_COL_MAJOR ) {
47  /* Call LAPACK function and adjust info */
48  LAPACK_zgttrs( &trans, &n, &nrhs, dl, d, du, du2, ipiv, b, &ldb,
49  &info );
50  if( info < 0 ) {
51  info = info - 1;
52  }
53  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
54  lapack_int ldb_t = MAX(1,n);
55  lapack_complex_double* b_t = NULL;
56  /* Check leading dimension(s) */
57  if( ldb < nrhs ) {
58  info = -11;
59  LAPACKE_xerbla( "LAPACKE_zgttrs_work", info );
60  return info;
61  }
62  /* Allocate memory for temporary array(s) */
63  b_t = (lapack_complex_double*)
65  ldb_t * MAX(1,nrhs) );
66  if( b_t == NULL ) {
68  goto exit_level_0;
69  }
70  /* Transpose input matrices */
71  LAPACKE_zge_trans( matrix_layout, n, nrhs, b, ldb, b_t, ldb_t );
72  /* Call LAPACK function and adjust info */
73  LAPACK_zgttrs( &trans, &n, &nrhs, dl, d, du, du2, ipiv, b_t, &ldb_t,
74  &info );
75  if( info < 0 ) {
76  info = info - 1;
77  }
78  /* Transpose output matrices */
79  LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, b_t, ldb_t, b, ldb );
80  /* Release memory and exit */
81  LAPACKE_free( b_t );
82 exit_level_0:
83  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
84  LAPACKE_xerbla( "LAPACKE_zgttrs_work", info );
85  }
86  } else {
87  info = -1;
88  LAPACKE_xerbla( "LAPACKE_zgttrs_work", info );
89  }
90  return info;
91 }
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACKE_free(p)
Definition: lapacke.h:113
#define lapack_complex_double
Definition: lapacke.h:90
#define MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
void LAPACK_zgttrs(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 *du2, const lapack_int *ipiv, lapack_complex_double *b, lapack_int *ldb, lapack_int *info)
#define LAPACK_COL_MAJOR
Definition: lapacke.h:120
void LAPACKE_xerbla(const char *name, lapack_int info)
#define lapack_int
Definition: lapacke.h:47
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:123
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)
Here is the call graph for this function:
Here is the caller graph for this function: