LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_ssfrk_work()

lapack_int LAPACKE_ssfrk_work ( int  matrix_layout,
char  transr,
char  uplo,
char  trans,
lapack_int  n,
lapack_int  k,
float  alpha,
const float *  a,
lapack_int  lda,
float  beta,
float *  c 
)

Definition at line 36 of file lapacke_ssfrk_work.c.

40 {
41  lapack_int info = 0;
42  if( matrix_layout == LAPACK_COL_MAJOR ) {
43  /* Call LAPACK function and adjust info */
44  LAPACK_ssfrk( &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  float* a_t = NULL;
54  float* c_t = NULL;
55  /* Check leading dimension(s) */
56  if( lda < ka ) {
57  info = -9;
58  LAPACKE_xerbla( "LAPACKE_ssfrk_work", info );
59  return info;
60  }
61  /* Allocate memory for temporary array(s) */
62  a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,ka) );
63  if( a_t == NULL ) {
65  goto exit_level_0;
66  }
67  c_t = (float*)
68  LAPACKE_malloc( sizeof(float) * ( 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_sge_trans( matrix_layout, na, ka, a, lda, a_t, lda_t );
75  LAPACKE_spf_trans( matrix_layout, transr, uplo, n, c, c_t );
76  /* Call LAPACK function and adjust info */
77  LAPACK_ssfrk( &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_spf_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_ssfrk_work", info );
89  }
90  } else {
91  info = -1;
92  LAPACKE_xerbla( "LAPACKE_ssfrk_work", info );
93  }
94  return info;
95 }
void LAPACK_ssfrk(char *transr, char *uplo, char *trans, lapack_int *n, lapack_int *k, float *alpha, const float *a, lapack_int *lda, float *beta, float *c)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACKE_free(p)
Definition: lapacke.h:113
void LAPACKE_sge_trans(int matrix_layout, lapack_int m, lapack_int n, const float *in, lapack_int ldin, float *out, lapack_int ldout)
#define MAX(x, y)
Definition: lapacke_utils.h:47
#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
void LAPACKE_spf_trans(int matrix_layout, char transr, char uplo, lapack_int n, const float *in, float *out)
#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: