LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dsytrf_aa_2stage_work()

lapack_int LAPACKE_dsytrf_aa_2stage_work ( int  matrix_layout,
char  uplo,
lapack_int  n,
double *  a,
lapack_int  lda,
double *  tb,
lapack_int  ltb,
lapack_int ipiv,
lapack_int ipiv2,
double *  work,
lapack_int  lwork 
)

Definition at line 35 of file lapacke_dsytrf_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_dsytrf_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  double* a_t = NULL;
54  double* tb_t = NULL;
55  /* Check leading dimension(s) */
56  if( lda < n ) {
57  info = -6;
58  LAPACKE_xerbla( "LAPACKE_dsytrf_aa_2stage_work", info );
59  return info;
60  }
61  if( ltb < 4*n ) {
62  info = -8;
63  LAPACKE_xerbla( "LAPACKE_dsytrf_aa_2stage_work", info );
64  return info;
65  }
66  /* Query optimal working array(s) size if requested */
67  if( lwork == -1 ) {
68  LAPACK_dsytrf_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 = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) );
75  if( a_t == NULL ) {
77  goto exit_level_0;
78  }
79  tb_t = (double*)LAPACKE_malloc( sizeof(double) * ltb );
80  if( tb_t == NULL ) {
82  goto exit_level_1;
83  }
84  /* Transpose input matrices */
85  LAPACKE_dsy_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
86  /* Call LAPACK function and adjust info */
87  LAPACK_dsytrf_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_dsy_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_dsytrf_aa_2stage_work", info );
102  }
103  } else {
104  info = -1;
105  LAPACKE_xerbla( "LAPACKE_dsytrf_aa_2stage_work", info );
106  }
107  return info;
Here is the call graph for this function:
Here is the caller graph for this function:
LAPACKE_free
#define LAPACKE_free(p)
Definition: lapacke.h:47
lapack_int
#define lapack_int
Definition: lapack.h:21
LAPACK_dsytrf_aa_2stage
void LAPACK_dsytrf_aa_2stage(char const *uplo, lapack_int const *n, double *A, lapack_int const *lda, double *TB, lapack_int const *ltb, lapack_int *ipiv, lapack_int *ipiv2, double *work, lapack_int const *lwork, lapack_int *info)
LAPACKE_dsy_trans
void LAPACKE_dsy_trans(int matrix_layout, char uplo, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
Definition: lapacke_dsy_trans.c:39
LAPACKE_xerbla
void LAPACKE_xerbla(const char *name, lapack_int info)
Definition: lapacke_xerbla.c:36
MAX
#define MAX(x, y)
Definition: lapacke_utils.h:47
LAPACK_TRANSPOSE_MEMORY_ERROR
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:57
LAPACKE_malloc
#define LAPACKE_malloc(size)
Definition: lapacke.h:44
LAPACK_ROW_MAJOR
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:53
LAPACK_COL_MAJOR
#define LAPACK_COL_MAJOR
Definition: lapacke.h:54