LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_csysv_aa_2stage_work()

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

Definition at line 35 of file lapacke_csysv_aa_2stage_work.c.

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