LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_chetrf_aa_2stage_work()

lapack_int LAPACKE_chetrf_aa_2stage_work ( int  matrix_layout,
char  uplo,
lapack_int  n,
lapack_complex_float a,
lapack_int  lda,
lapack_complex_float tb,
lapack_int  ltb,
lapack_int ipiv,
lapack_int ipiv2,
lapack_complex_float work,
lapack_int  lwork 
)

Definition at line 36 of file lapacke_chetrf_aa_2stage_work.c.

41 {
42  lapack_int info = 0;
43  if( matrix_layout == LAPACK_COL_MAJOR ) {
44  /* Call LAPACK function and adjust info */
45  LAPACK_chetrf_aa_2stage( &uplo, &n, a, &lda, tb,
46  &ltb, ipiv, ipiv2, work, &lwork,
47  &info );
48  if( info < 0 ) {
49  info = info - 1;
50  }
51  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
52  lapack_int lda_t = MAX(1,n);
53  lapack_complex_float* a_t = NULL;
54  lapack_complex_float* tb_t = NULL;
55  /* Check leading dimension(s) */
56  if( lda < n ) {
57  info = -6;
58  LAPACKE_xerbla( "LAPACKE_chetrf_aa_2stage_work", info );
59  return info;
60  }
61  if( ltb < 4*n ) {
62  info = -8;
63  LAPACKE_xerbla( "LAPACKE_chetrf_aa_2stage_work", info );
64  return info;
65  }
66  /* Query optimal working array(s) size if requested */
67  if( lwork == -1 ) {
68  LAPACK_chetrf_aa_2stage( &uplo, &n, a, &lda_t,
69  tb, &ltb, ipiv, ipiv2, work,
70  &lwork, &info );
71  return (info < 0) ? (info - 1) : info;
72  }
73  /* Allocate memory for temporary array(s) */
74  a_t = (lapack_complex_float*)LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
75  if( a_t == NULL ) {
77  goto exit_level_0;
78  }
80  if( tb_t == NULL ) {
82  goto exit_level_1;
83  }
84  /* Transpose input matrices */
85  LAPACKE_che_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
86  /* Call LAPACK function and adjust info */
87  LAPACK_chetrf_aa_2stage( &uplo, &n, a_t, &lda_t,
88  tb_t, &ltb, ipiv, ipiv2, work,
89  &lwork, &info );
90  if( info < 0 ) {
91  info = info - 1;
92  }
93  /* Transpose output matrices */
94  LAPACKE_che_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
95  /* Release memory and exit */
96  LAPACKE_free( tb_t );
97 exit_level_1:
98  LAPACKE_free( a_t );
99 exit_level_0:
100  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
101  LAPACKE_xerbla( "LAPACKE_chetrf_aa_2stage_work", info );
102  }
103  } else {
104  info = -1;
105  LAPACKE_xerbla( "LAPACKE_chetrf_aa_2stage_work", info );
106  }
107  return info;
108 }
#define MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACK_COL_MAJOR
Definition: lapacke.h:120
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:123
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define lapack_complex_float
Definition: lapacke.h:74
void LAPACK_chetrf_aa_2stage(char *uplo, lapack_int *n, lapack_complex_float *a, lapack_int *lda, lapack_complex_float *tb, lapack_int *ltb, lapack_int *ipiv, lapack_int *ipiv2, lapack_complex_float *work, lapack_int *lwork, lapack_int *info)
#define lapack_int
Definition: lapacke.h:47
void LAPACKE_che_trans(int matrix_layout, char uplo, lapack_int n, const lapack_complex_float *in, lapack_int ldin, lapack_complex_float *out, lapack_int ldout)
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
#define LAPACKE_free(p)
Definition: lapacke.h:113
void LAPACKE_xerbla(const char *name, lapack_int info)
Here is the call graph for this function:
Here is the caller graph for this function: