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

Go to the source code of this file.

Functions

lapack_int LAPACKE_stprfs_work (int matrix_layout, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const float *ap, const float *b, lapack_int ldb, const float *x, lapack_int ldx, float *ferr, float *berr, float *work, lapack_int *iwork)

Function Documentation

◆ LAPACKE_stprfs_work()

lapack_int LAPACKE_stprfs_work ( int matrix_layout,
char uplo,
char trans,
char diag,
lapack_int n,
lapack_int nrhs,
const float * ap,
const float * b,
lapack_int ldb,
const float * x,
lapack_int ldx,
float * ferr,
float * berr,
float * work,
lapack_int * iwork )

Definition at line 35 of file lapacke_stprfs_work.c.

40{
41 lapack_int info = 0;
42 if( matrix_layout == LAPACK_COL_MAJOR ) {
43 /* Call LAPACK function and adjust info */
44 LAPACK_stprfs( &uplo, &trans, &diag, &n, &nrhs, ap, b, &ldb, x, &ldx,
45 ferr, berr, work, iwork, &info );
46 if( info < 0 ) {
47 info = info - 1;
48 }
49 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
50 lapack_int ldb_t = MAX(1,n);
51 lapack_int ldx_t = MAX(1,n);
52 float* b_t = NULL;
53 float* x_t = NULL;
54 float* ap_t = NULL;
55 /* Check leading dimension(s) */
56 if( ldb < nrhs ) {
57 info = -9;
58 LAPACKE_xerbla( "LAPACKE_stprfs_work", info );
59 return info;
60 }
61 if( ldx < nrhs ) {
62 info = -11;
63 LAPACKE_xerbla( "LAPACKE_stprfs_work", info );
64 return info;
65 }
66 /* Allocate memory for temporary array(s) */
67 b_t = (float*)LAPACKE_malloc( sizeof(float) * ldb_t * MAX(1,nrhs) );
68 if( b_t == NULL ) {
70 goto exit_level_0;
71 }
72 x_t = (float*)LAPACKE_malloc( sizeof(float) * ldx_t * MAX(1,nrhs) );
73 if( x_t == NULL ) {
75 goto exit_level_1;
76 }
77 ap_t = (float*)
78 LAPACKE_malloc( sizeof(float) * ( MAX(1,n) * MAX(2,n+1) ) / 2 );
79 if( ap_t == NULL ) {
81 goto exit_level_2;
82 }
83 /* Transpose input matrices */
84 LAPACKE_sge_trans( matrix_layout, n, nrhs, b, ldb, b_t, ldb_t );
85 LAPACKE_sge_trans( matrix_layout, n, nrhs, x, ldx, x_t, ldx_t );
86 LAPACKE_stp_trans( matrix_layout, uplo, diag, n, ap, ap_t );
87 /* Call LAPACK function and adjust info */
88 LAPACK_stprfs( &uplo, &trans, &diag, &n, &nrhs, ap_t, b_t, &ldb_t, x_t,
89 &ldx_t, ferr, berr, work, iwork, &info );
90 if( info < 0 ) {
91 info = info - 1;
92 }
93 /* Release memory and exit */
94 LAPACKE_free( ap_t );
95exit_level_2:
96 LAPACKE_free( x_t );
97exit_level_1:
98 LAPACKE_free( b_t );
99exit_level_0:
100 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
101 LAPACKE_xerbla( "LAPACKE_stprfs_work", info );
102 }
103 } else {
104 info = -1;
105 LAPACKE_xerbla( "LAPACKE_stprfs_work", info );
106 }
107 return info;
108}
#define LAPACK_stprfs(...)
Definition lapack.h:21036
#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_xerbla(const char *name, lapack_int info)
void LAPACKE_sge_trans(int matrix_layout, lapack_int m, lapack_int n, const float *in, lapack_int ldin, float *out, lapack_int ldout)
void LAPACKE_stp_trans(int matrix_layout, char uplo, char diag, lapack_int n, const float *in, float *out)
#define MAX(x, y)
n