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

Go to the source code of this file.

Functions

lapack_int LAPACKE_dsysvx_work (int matrix_layout, char fact, char uplo, lapack_int n, lapack_int nrhs, const double *a, lapack_int lda, double *af, lapack_int ldaf, lapack_int *ipiv, const double *b, lapack_int ldb, double *x, lapack_int ldx, double *rcond, double *ferr, double *berr, double *work, lapack_int lwork, lapack_int *iwork)

Function Documentation

◆ LAPACKE_dsysvx_work()

lapack_int LAPACKE_dsysvx_work ( int matrix_layout,
char fact,
char uplo,
lapack_int n,
lapack_int nrhs,
const double * a,
lapack_int lda,
double * af,
lapack_int ldaf,
lapack_int * ipiv,
const double * b,
lapack_int ldb,
double * x,
lapack_int ldx,
double * rcond,
double * ferr,
double * berr,
double * work,
lapack_int lwork,
lapack_int * iwork )

Definition at line 35 of file lapacke_dsysvx_work.c.

43{
44 lapack_int info = 0;
45 if( matrix_layout == LAPACK_COL_MAJOR ) {
46 /* Call LAPACK function and adjust info */
47 LAPACK_dsysvx( &fact, &uplo, &n, &nrhs, a, &lda, af, &ldaf, ipiv, b,
48 &ldb, x, &ldx, rcond, ferr, berr, work, &lwork, iwork,
49 &info );
50 if( info < 0 ) {
51 info = info - 1;
52 }
53 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
54 lapack_int lda_t = MAX(1,n);
55 lapack_int ldaf_t = MAX(1,n);
56 lapack_int ldb_t = MAX(1,n);
57 lapack_int ldx_t = MAX(1,n);
58 double* a_t = NULL;
59 double* af_t = NULL;
60 double* b_t = NULL;
61 double* x_t = NULL;
62 /* Check leading dimension(s) */
63 if( lda < n ) {
64 info = -7;
65 LAPACKE_xerbla( "LAPACKE_dsysvx_work", info );
66 return info;
67 }
68 if( ldaf < n ) {
69 info = -9;
70 LAPACKE_xerbla( "LAPACKE_dsysvx_work", info );
71 return info;
72 }
73 if( ldb < nrhs ) {
74 info = -12;
75 LAPACKE_xerbla( "LAPACKE_dsysvx_work", info );
76 return info;
77 }
78 if( ldx < nrhs ) {
79 info = -14;
80 LAPACKE_xerbla( "LAPACKE_dsysvx_work", info );
81 return info;
82 }
83 /* Query optimal working array(s) size if requested */
84 if( lwork == -1 ) {
85 LAPACK_dsysvx( &fact, &uplo, &n, &nrhs, a, &lda_t, af, &ldaf_t,
86 ipiv, b, &ldb_t, x, &ldx_t, rcond, ferr, berr, work,
87 &lwork, iwork, &info );
88 return (info < 0) ? (info - 1) : info;
89 }
90 /* Allocate memory for temporary array(s) */
91 a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) );
92 if( a_t == NULL ) {
94 goto exit_level_0;
95 }
96 af_t = (double*)LAPACKE_malloc( sizeof(double) * ldaf_t * MAX(1,n) );
97 if( af_t == NULL ) {
99 goto exit_level_1;
100 }
101 b_t = (double*)LAPACKE_malloc( sizeof(double) * ldb_t * MAX(1,nrhs) );
102 if( b_t == NULL ) {
104 goto exit_level_2;
105 }
106 x_t = (double*)LAPACKE_malloc( sizeof(double) * ldx_t * MAX(1,nrhs) );
107 if( x_t == NULL ) {
109 goto exit_level_3;
110 }
111 /* Transpose input matrices */
112 LAPACKE_dsy_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
113 if( LAPACKE_lsame( fact, 'f' ) ) {
114 LAPACKE_dsy_trans( matrix_layout, uplo, n, af, ldaf, af_t, ldaf_t );
115 }
116 LAPACKE_dge_trans( matrix_layout, n, nrhs, b, ldb, b_t, ldb_t );
117 /* Call LAPACK function and adjust info */
118 LAPACK_dsysvx( &fact, &uplo, &n, &nrhs, a_t, &lda_t, af_t, &ldaf_t,
119 ipiv, b_t, &ldb_t, x_t, &ldx_t, rcond, ferr, berr, work,
120 &lwork, iwork, &info );
121 if( info < 0 ) {
122 info = info - 1;
123 }
124 /* Transpose output matrices */
125 if( LAPACKE_lsame( fact, 'n' ) ) {
126 LAPACKE_dsy_trans( LAPACK_COL_MAJOR, uplo, n, af_t, ldaf_t, af,
127 ldaf );
128 }
129 LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, nrhs, x_t, ldx_t, x, ldx );
130 /* Release memory and exit */
131 LAPACKE_free( x_t );
132exit_level_3:
133 LAPACKE_free( b_t );
134exit_level_2:
135 LAPACKE_free( af_t );
136exit_level_1:
137 LAPACKE_free( a_t );
138exit_level_0:
139 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
140 LAPACKE_xerbla( "LAPACKE_dsysvx_work", info );
141 }
142 } else {
143 info = -1;
144 LAPACKE_xerbla( "LAPACKE_dsysvx_work", info );
145 }
146 return info;
147}
#define LAPACK_dsysvx(...)
Definition lapack.h:18182
#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)
#define MAX(x, y)
void LAPACKE_dge_trans(int matrix_layout, lapack_int m, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
void LAPACKE_dsy_trans(int matrix_layout, char uplo, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
n