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