LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dsysv_aa_2stage_work()

lapack_int LAPACKE_dsysv_aa_2stage_work ( int  matrix_layout,
char  uplo,
lapack_int  n,
lapack_int  nrhs,
double *  a,
lapack_int  lda,
double *  tb,
lapack_int  ltb,
lapack_int ipiv,
lapack_int ipiv2,
double *  b,
lapack_int  ldb,
double *  work,
lapack_int  lwork 
)

Definition at line 35 of file lapacke_dsysv_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_dsysv_aa_2stage( &uplo, &n, &nrhs, a, &lda, tb,
46  &ltb, ipiv, ipiv2, b, &ldb, 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  double* b_t = NULL;
57  /* Check leading dimension(s) */
58  if( lda < n ) {
59  info = -6;
60  LAPACKE_xerbla( "LAPACKE_dsysv_aa_2stage_work", info );
61  return info;
62  }
63  if( ltb < 4*n ) {
64  info = -8;
65  LAPACKE_xerbla( "LAPACKE_dsysv_aa_2stage_work", info );
66  return info;
67  }
68  if( ldb < nrhs ) {
69  info = -12;
70  LAPACKE_xerbla( "LAPACKE_dsysv_aa_2stage_work", info );
71  return info;
72  }
73  /* Query optimal working array(s) size if requested */
74  if( lwork == -1 ) {
75  LAPACK_dsysv_aa_2stage( &uplo, &n, &nrhs, a, &lda_t,
76  tb, &ltb, ipiv, ipiv2, b, &ldb_t, work,
77  &lwork, &info );
78  return (info < 0) ? (info - 1) : info;
79  }
80  /* Allocate memory for temporary array(s) */
81  a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) );
82  if( a_t == NULL ) {
84  goto exit_level_0;
85  }
86  tb_t = (double*)LAPACKE_malloc( sizeof(double) * ltb );
87  if( tb_t == NULL ) {
89  goto exit_level_1;
90  }
91  b_t = (double*)LAPACKE_malloc( sizeof(double) * ldb_t * MAX(1,nrhs) );
92  if( b_t == NULL ) {
94  goto exit_level_2;
95  }
96  /* Transpose input matrices */
97  LAPACKE_dsy_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
98  LAPACKE_dge_trans( matrix_layout, n, nrhs, b, ldb, b_t, ldb_t );
99  /* Call LAPACK function and adjust info */
100  LAPACK_dsysv_aa_2stage( &uplo, &n, &nrhs, a_t, &lda_t,
101  tb_t, &ltb, ipiv, ipiv2, b_t, &ldb_t, work,
102  &lwork, &info );
103  if( info < 0 ) {
104  info = info - 1;
105  }
106  /* Transpose output matrices */
107  LAPACKE_dsy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
108  LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, nrhs, b_t, ldb_t, b, ldb );
109  /* Release memory and exit */
110  LAPACKE_free( b_t );
111 exit_level_2:
112  LAPACKE_free( tb_t );
113 exit_level_1:
114  LAPACKE_free( a_t );
115 exit_level_0:
116  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
117  LAPACKE_xerbla( "LAPACKE_dsysv_aa_2stage_work", info );
118  }
119  } else {
120  info = -1;
121  LAPACKE_xerbla( "LAPACKE_dsysv_aa_2stage_work", info );
122  }
123  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
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_dsysv_aa_2stage
void LAPACK_dsysv_aa_2stage(char const *uplo, lapack_int const *n, lapack_int const *nrhs, double *A, lapack_int const *lda, double *TB, lapack_int const *ltb, lapack_int *ipiv, lapack_int *ipiv2, double *B, lapack_int const *ldb, double *work, lapack_int const *lwork, lapack_int *info)
LAPACK_ROW_MAJOR
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:53
LAPACKE_dge_trans
void LAPACKE_dge_trans(int matrix_layout, lapack_int m, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
Definition: lapacke_dge_trans.c:39
LAPACK_COL_MAJOR
#define LAPACK_COL_MAJOR
Definition: lapacke.h:54