LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_chfrk_work ( int  matrix_layout,
char  transr,
char  uplo,
char  trans,
lapack_int  n,
lapack_int  k,
float  alpha,
const lapack_complex_float a,
lapack_int  lda,
float  beta,
lapack_complex_float c 
)

Definition at line 36 of file lapacke_chfrk_work.c.

41 {
42  lapack_int info = 0;
43  lapack_int na, ka, lda_t;
44  lapack_complex_float *a_t = NULL, *c_t = NULL;
45  if( matrix_layout == LAPACK_COL_MAJOR ) {
46  /* Call LAPACK function and adjust info */
47  LAPACK_chfrk( &transr, &uplo, &trans, &n, &k, &alpha, a, &lda, &beta,
48  c );
49  if( info < 0 ) {
50  info = info - 1;
51  }
52  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
53  na = LAPACKE_lsame( trans, 'n' ) ? n : k;
54  ka = LAPACKE_lsame( trans, 'n' ) ? k : n;
55  lda_t = MAX(1,na);
56  /* Check leading dimension(s) */
57  if( lda < ka ) {
58  info = -9;
59  LAPACKE_xerbla( "LAPACKE_chfrk_work", info );
60  return info;
61  }
62  /* Allocate memory for temporary array(s) */
63  a_t = (lapack_complex_float*)
64  LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,ka) );
65  if( a_t == NULL ) {
67  goto exit_level_0;
68  }
69  c_t = (lapack_complex_float*)
71  ( MAX(1,n) * MAX(2,n+1) ) / 2 );
72  if( c_t == NULL ) {
74  goto exit_level_1;
75  }
76  /* Transpose input matrices */
77  LAPACKE_cge_trans( matrix_layout, na, ka, a, lda, a_t, lda_t );
78  LAPACKE_cpf_trans( matrix_layout, transr, uplo, n, c, c_t );
79  /* Call LAPACK function and adjust info */
80  LAPACK_chfrk( &transr, &uplo, &trans, &n, &k, &alpha, a_t, &lda_t,
81  &beta, c_t );
82  info = 0; /* LAPACK call is ok! */
83  /* Transpose output matrices */
84  LAPACKE_cpf_trans( LAPACK_COL_MAJOR, transr, uplo, n, c_t, c );
85  /* Release memory and exit */
86  LAPACKE_free( c_t );
87 exit_level_1:
88  LAPACKE_free( a_t );
89 exit_level_0:
90  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
91  LAPACKE_xerbla( "LAPACKE_chfrk_work", info );
92  }
93  } else {
94  info = -1;
95  LAPACKE_xerbla( "LAPACKE_chfrk_work", info );
96  }
97  return info;
98 }
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)
void LAPACKE_cpf_trans(int matrix_layout, char transr, char uplo, lapack_int n, const lapack_complex_float *in, lapack_complex_float *out)
void LAPACK_chfrk(char *transr, char *uplo, char *trans, lapack_int *n, lapack_int *k, float *alpha, const lapack_complex_float *a, lapack_int *lda, float *beta, lapack_complex_float *c)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define lapack_complex_float
Definition: lapacke.h:74
#define MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACKE_free(p)
Definition: lapacke.h:113
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:36
#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

Here is the call graph for this function:

Here is the caller graph for this function: