OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
lapacke_ssfrk_work.c File Reference
#include "lapacke_utils.h"

Go to the source code of this file.

Functions

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)

Function Documentation

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

39{
40 lapack_int info = 0;
41 if( matrix_layout == LAPACK_COL_MAJOR ) {
42 /* Call LAPACK function and adjust info */
43 LAPACK_ssfrk( &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 float* a_t = NULL;
53 float* c_t = NULL;
54 /* Check leading dimension(s) */
55 if( lda < ka ) {
56 info = -9;
57 LAPACKE_xerbla( "LAPACKE_ssfrk_work", info );
58 return info;
59 }
60 /* Allocate memory for temporary array(s) */
61 a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,ka) );
62 if( a_t == NULL ) {
64 goto exit_level_0;
65 }
66 c_t = (float*)
67 LAPACKE_malloc( sizeof(float) * ( 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_sge_trans( matrix_layout, na, ka, a, lda, a_t, lda_t );
74 LAPACKE_spf_trans( matrix_layout, transr, uplo, n, c, c_t );
75 /* Call LAPACK function and adjust info */
76 LAPACK_ssfrk( &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_spf_trans( LAPACK_COL_MAJOR, transr, uplo, n, c_t, c );
81 /* Release memory and exit */
82 LAPACKE_free( c_t );
83exit_level_1:
84 LAPACKE_free( a_t );
85exit_level_0:
86 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
87 LAPACKE_xerbla( "LAPACKE_ssfrk_work", info );
88 }
89 } else {
90 info = -1;
91 LAPACKE_xerbla( "LAPACKE_ssfrk_work", info );
92 }
93 return info;
94}
#define alpha
Definition eval.h:35
#define LAPACK_ssfrk(...)
Definition lapack.h:15210
#define lapack_int
Definition lapack.h:83
#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)
void LAPACKE_xerbla(const char *name, lapack_int info)
void LAPACKE_spf_trans(int matrix_layout, char transr, char uplo, lapack_int n, const float *in, float *out)
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)
n