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

Go to the source code of this file.

Functions

lapack_int LAPACKE_sporfs_work (int matrix_layout, char uplo, lapack_int n, lapack_int nrhs, const float *a, lapack_int lda, const float *af, lapack_int ldaf, const float *b, lapack_int ldb, float *x, lapack_int ldx, float *ferr, float *berr, float *work, lapack_int *iwork)

Function Documentation

◆ LAPACKE_sporfs_work()

lapack_int LAPACKE_sporfs_work ( int matrix_layout,
char uplo,
lapack_int n,
lapack_int nrhs,
const float * a,
lapack_int lda,
const float * af,
lapack_int ldaf,
const float * b,
lapack_int ldb,
float * x,
lapack_int ldx,
float * ferr,
float * berr,
float * work,
lapack_int * iwork )

Definition at line 35 of file lapacke_sporfs_work.c.

41{
42 lapack_int info = 0;
43 if( matrix_layout == LAPACK_COL_MAJOR ) {
44 /* Call LAPACK function and adjust info */
45 LAPACK_sporfs( &uplo, &n, &nrhs, a, &lda, af, &ldaf, b, &ldb, x, &ldx,
46 ferr, berr, work, iwork, &info );
47 if( info < 0 ) {
48 info = info - 1;
49 }
50 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
51 lapack_int lda_t = MAX(1,n);
52 lapack_int ldaf_t = MAX(1,n);
53 lapack_int ldb_t = MAX(1,n);
54 lapack_int ldx_t = MAX(1,n);
55 float* a_t = NULL;
56 float* af_t = NULL;
57 float* b_t = NULL;
58 float* x_t = NULL;
59 /* Check leading dimension(s) */
60 if( lda < n ) {
61 info = -6;
62 LAPACKE_xerbla( "LAPACKE_sporfs_work", info );
63 return info;
64 }
65 if( ldaf < n ) {
66 info = -8;
67 LAPACKE_xerbla( "LAPACKE_sporfs_work", info );
68 return info;
69 }
70 if( ldb < nrhs ) {
71 info = -10;
72 LAPACKE_xerbla( "LAPACKE_sporfs_work", info );
73 return info;
74 }
75 if( ldx < nrhs ) {
76 info = -12;
77 LAPACKE_xerbla( "LAPACKE_sporfs_work", info );
78 return info;
79 }
80 /* Allocate memory for temporary array(s) */
81 a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,n) );
82 if( a_t == NULL ) {
84 goto exit_level_0;
85 }
86 af_t = (float*)LAPACKE_malloc( sizeof(float) * ldaf_t * MAX(1,n) );
87 if( af_t == NULL ) {
89 goto exit_level_1;
90 }
91 b_t = (float*)LAPACKE_malloc( sizeof(float) * ldb_t * MAX(1,nrhs) );
92 if( b_t == NULL ) {
94 goto exit_level_2;
95 }
96 x_t = (float*)LAPACKE_malloc( sizeof(float) * ldx_t * MAX(1,nrhs) );
97 if( x_t == NULL ) {
99 goto exit_level_3;
100 }
101 /* Transpose input matrices */
102 LAPACKE_spo_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
103 LAPACKE_spo_trans( matrix_layout, uplo, n, af, ldaf, af_t, ldaf_t );
104 LAPACKE_sge_trans( matrix_layout, n, nrhs, b, ldb, b_t, ldb_t );
105 LAPACKE_sge_trans( matrix_layout, n, nrhs, x, ldx, x_t, ldx_t );
106 /* Call LAPACK function and adjust info */
107 LAPACK_sporfs( &uplo, &n, &nrhs, a_t, &lda_t, af_t, &ldaf_t, b_t,
108 &ldb_t, x_t, &ldx_t, ferr, berr, work, iwork, &info );
109 if( info < 0 ) {
110 info = info - 1;
111 }
112 /* Transpose output matrices */
113 LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, nrhs, x_t, ldx_t, x, ldx );
114 /* Release memory and exit */
115 LAPACKE_free( x_t );
116exit_level_3:
117 LAPACKE_free( b_t );
118exit_level_2:
119 LAPACKE_free( af_t );
120exit_level_1:
121 LAPACKE_free( a_t );
122exit_level_0:
123 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
124 LAPACKE_xerbla( "LAPACKE_sporfs_work", info );
125 }
126 } else {
127 info = -1;
128 LAPACKE_xerbla( "LAPACKE_sporfs_work", info );
129 }
130 return info;
131}
#define LAPACK_sporfs(...)
Definition lapack.h:12832
#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_spo_trans(int matrix_layout, char uplo, lapack_int n, const float *in, lapack_int ldin, float *out, lapack_int ldout)
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