LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_zhfrk_work()

lapack_int LAPACKE_zhfrk_work ( int  matrix_layout,
char  transr,
char  uplo,
char  trans,
lapack_int  n,
lapack_int  k,
double  alpha,
const lapack_complex_double a,
lapack_int  lda,
double  beta,
lapack_complex_double c 
)

Definition at line 35 of file lapacke_zhfrk_work.c.

40 {
41  lapack_int info = 0;
42  lapack_int na, ka, lda_t;
43  lapack_complex_double *a_t = NULL, *c_t = NULL;
44  if( matrix_layout == LAPACK_COL_MAJOR ) {
45  /* Call LAPACK function and adjust info */
46  LAPACK_zhfrk( &transr, &uplo, &trans, &n, &k, &alpha, a, &lda, &beta,
47  c );
48  if( info < 0 ) {
49  info = info - 1;
50  }
51  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
52  na = LAPACKE_lsame( trans, 'n' ) ? n : k;
53  ka = LAPACKE_lsame( trans, 'n' ) ? k : n;
54  lda_t = MAX(1,na);
55  /* Check leading dimension(s) */
56  if( lda < ka ) {
57  info = -9;
58  LAPACKE_xerbla( "LAPACKE_zhfrk_work", info );
59  return info;
60  }
61  /* Allocate memory for temporary array(s) */
62  a_t = (lapack_complex_double*)
63  LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,ka) );
64  if( a_t == NULL ) {
66  goto exit_level_0;
67  }
68  c_t = (lapack_complex_double*)
70  ( MAX(1,n) * MAX(2,n+1) ) / 2 );
71  if( c_t == NULL ) {
73  goto exit_level_1;
74  }
75  /* Transpose input matrices */
76  LAPACKE_zge_trans( matrix_layout, na, ka, a, lda, a_t, lda_t );
77  LAPACKE_zpf_trans( matrix_layout, transr, uplo, n, c, c_t );
78  /* Call LAPACK function and adjust info */
79  LAPACK_zhfrk( &transr, &uplo, &trans, &n, &k, &alpha, a_t, &lda_t,
80  &beta, c_t );
81  info = 0; /* LAPACK call is ok! */
82  /* Transpose output matrices */
83  LAPACKE_zpf_trans( LAPACK_COL_MAJOR, transr, uplo, n, c_t, c );
84  /* Release memory and exit */
85  LAPACKE_free( c_t );
86 exit_level_1:
87  LAPACKE_free( a_t );
88 exit_level_0:
89  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
90  LAPACKE_xerbla( "LAPACKE_zhfrk_work", info );
91  }
92  } else {
93  info = -1;
94  LAPACKE_xerbla( "LAPACKE_zhfrk_work", info );
95  }
96  return info;
97 }
#define lapack_int
Definition: lapack.h:83
#define LAPACK_zhfrk(...)
Definition: lapack.h:8331
#define lapack_complex_double
Definition: lapack.h:63
#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_zpf_trans(int matrix_layout, char transr, char uplo, lapack_int n, const lapack_complex_double *in, lapack_complex_double *out)
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
void LAPACKE_xerbla(const char *name, lapack_int info)
void LAPACKE_zge_trans(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_double *in, lapack_int ldin, lapack_complex_double *out, lapack_int ldout)
#define MAX(x, y)
Definition: lapacke_utils.h:46
Here is the call graph for this function:
Here is the caller graph for this function: