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

Definition at line 36 of file lapacke_dsfrk_work.c.

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

Here is the call graph for this function:

Here is the caller graph for this function: