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

Go to the source code of this file.

Functions

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

Function Documentation

◆ LAPACKE_dtfsm_work()

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

Definition at line 35 of file lapacke_dtfsm_work.c.

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