LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dsfrk_work()

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 35 of file lapacke_dsfrk_work.c.

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