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

Go to the source code of this file.

Functions

lapack_int LAPACKE_stfsm_work (int matrix_layout, char transr, char side, char uplo, char trans, char diag, lapack_int m, lapack_int n, float alpha, const float *a, float *b, lapack_int ldb)

Function Documentation

◆ LAPACKE_stfsm_work()

lapack_int LAPACKE_stfsm_work ( int matrix_layout,
char transr,
char side,
char uplo,
char trans,
char diag,
lapack_int m,
lapack_int n,
float alpha,
const float * a,
float * b,
lapack_int ldb )

Definition at line 35 of file lapacke_stfsm_work.c.

39{
40 lapack_int info = 0;
41 if( matrix_layout == LAPACK_COL_MAJOR ) {
42 /* Call LAPACK function and adjust info */
43 LAPACK_stfsm( &transr, &side, &uplo, &trans, &diag, &m, &n, &alpha, a,
44 b, &ldb );
45 if( info < 0 ) {
46 info = info - 1;
47 }
48 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
49 lapack_int ldb_t = MAX(1,m);
50 float* b_t = NULL;
51 float* a_t = NULL;
52 /* Check leading dimension(s) */
53 if( ldb < n ) {
54 info = -12;
55 LAPACKE_xerbla( "LAPACKE_stfsm_work", info );
56 return info;
57 }
58 /* Allocate memory for temporary array(s) */
59 b_t = (float*)LAPACKE_malloc( sizeof(float) * ldb_t * MAX(1,n) );
60 if( b_t == NULL ) {
62 goto exit_level_0;
63 }
64 if( IS_S_NONZERO(alpha) ) {
65 a_t = (float*)
66 LAPACKE_malloc( sizeof(float) * ( MAX(1,n) * MAX(2,n+1) ) / 2 );
67 if( a_t == NULL ) {
69 goto exit_level_1;
70 }
71 }
72 /* Transpose input matrices */
73 if( IS_S_NONZERO(alpha) ) {
74 LAPACKE_sge_trans( matrix_layout, m, n, b, ldb, b_t, ldb_t );
75 }
76 if( IS_S_NONZERO(alpha) ) {
77 LAPACKE_stf_trans( matrix_layout, transr, uplo, diag, n, a, a_t );
78 }
79 /* Call LAPACK function and adjust info */
80 LAPACK_stfsm( &transr, &side, &uplo, &trans, &diag, &m, &n, &alpha, a_t,
81 b_t, &ldb_t );
82 info = 0; /* LAPACK call is ok! */
83 /* Transpose output matrices */
84 LAPACKE_sge_trans( LAPACK_COL_MAJOR, m, n, b_t, ldb_t, b, ldb );
85 /* Release memory and exit */
86 if( IS_S_NONZERO(alpha) ) {
87 LAPACKE_free( a_t );
88 }
89exit_level_1:
90 LAPACKE_free( b_t );
91exit_level_0:
92 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
93 LAPACKE_xerbla( "LAPACKE_stfsm_work", info );
94 }
95 } else {
96 info = -1;
97 LAPACKE_xerbla( "LAPACKE_stfsm_work", info );
98 }
99 return info;
100}
#define alpha
Definition eval.h:35
#define lapack_int
Definition lapack.h:83
#define LAPACK_stfsm(...)
Definition lapack.h:19819
#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
void LAPACKE_xerbla(const char *name, lapack_int info)
#define IS_S_NONZERO(x)
void LAPACKE_stf_trans(int matrix_layout, char transr, char uplo, char diag, 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