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

Go to the source code of this file.

Functions

lapack_int LAPACKE_dpbrfs_work (int matrix_layout, char uplo, lapack_int n, lapack_int kd, lapack_int nrhs, const double *ab, lapack_int ldab, const double *afb, lapack_int ldafb, const double *b, lapack_int ldb, double *x, lapack_int ldx, double *ferr, double *berr, double *work, lapack_int *iwork)

Function Documentation

◆ LAPACKE_dpbrfs_work()

lapack_int LAPACKE_dpbrfs_work ( int matrix_layout,
char uplo,
lapack_int n,
lapack_int kd,
lapack_int nrhs,
const double * ab,
lapack_int ldab,
const double * afb,
lapack_int ldafb,
const double * b,
lapack_int ldb,
double * x,
lapack_int ldx,
double * ferr,
double * berr,
double * work,
lapack_int * iwork )

Definition at line 35 of file lapacke_dpbrfs_work.c.

42{
43 lapack_int info = 0;
44 if( matrix_layout == LAPACK_COL_MAJOR ) {
45 /* Call LAPACK function and adjust info */
46 LAPACK_dpbrfs( &uplo, &n, &kd, &nrhs, ab, &ldab, afb, &ldafb, b, &ldb,
47 x, &ldx, ferr, berr, work, iwork, &info );
48 if( info < 0 ) {
49 info = info - 1;
50 }
51 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
52 lapack_int ldab_t = MAX(1,kd+1);
53 lapack_int ldafb_t = MAX(1,kd+1);
54 lapack_int ldb_t = MAX(1,n);
55 lapack_int ldx_t = MAX(1,n);
56 double* ab_t = NULL;
57 double* afb_t = NULL;
58 double* b_t = NULL;
59 double* x_t = NULL;
60 /* Check leading dimension(s) */
61 if( ldab < n ) {
62 info = -7;
63 LAPACKE_xerbla( "LAPACKE_dpbrfs_work", info );
64 return info;
65 }
66 if( ldafb < n ) {
67 info = -9;
68 LAPACKE_xerbla( "LAPACKE_dpbrfs_work", info );
69 return info;
70 }
71 if( ldb < nrhs ) {
72 info = -11;
73 LAPACKE_xerbla( "LAPACKE_dpbrfs_work", info );
74 return info;
75 }
76 if( ldx < nrhs ) {
77 info = -13;
78 LAPACKE_xerbla( "LAPACKE_dpbrfs_work", info );
79 return info;
80 }
81 /* Allocate memory for temporary array(s) */
82 ab_t = (double*)LAPACKE_malloc( sizeof(double) * ldab_t * MAX(1,n) );
83 if( ab_t == NULL ) {
85 goto exit_level_0;
86 }
87 afb_t = (double*)LAPACKE_malloc( sizeof(double) * ldafb_t * MAX(1,n) );
88 if( afb_t == NULL ) {
90 goto exit_level_1;
91 }
92 b_t = (double*)LAPACKE_malloc( sizeof(double) * ldb_t * MAX(1,nrhs) );
93 if( b_t == NULL ) {
95 goto exit_level_2;
96 }
97 x_t = (double*)LAPACKE_malloc( sizeof(double) * ldx_t * MAX(1,nrhs) );
98 if( x_t == NULL ) {
100 goto exit_level_3;
101 }
102 /* Transpose input matrices */
103 LAPACKE_dpb_trans( matrix_layout, uplo, n, kd, ab, ldab, ab_t, ldab_t );
104 LAPACKE_dpb_trans( matrix_layout, uplo, n, kd, afb, ldafb, afb_t,
105 ldafb_t );
106 LAPACKE_dge_trans( matrix_layout, n, nrhs, b, ldb, b_t, ldb_t );
107 LAPACKE_dge_trans( matrix_layout, n, nrhs, x, ldx, x_t, ldx_t );
108 /* Call LAPACK function and adjust info */
109 LAPACK_dpbrfs( &uplo, &n, &kd, &nrhs, ab_t, &ldab_t, afb_t, &ldafb_t,
110 b_t, &ldb_t, x_t, &ldx_t, ferr, berr, work, iwork,
111 &info );
112 if( info < 0 ) {
113 info = info - 1;
114 }
115 /* Transpose output matrices */
116 LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, nrhs, x_t, ldx_t, x, ldx );
117 /* Release memory and exit */
118 LAPACKE_free( x_t );
119exit_level_3:
120 LAPACKE_free( b_t );
121exit_level_2:
122 LAPACKE_free( afb_t );
123exit_level_1:
124 LAPACKE_free( ab_t );
125exit_level_0:
126 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
127 LAPACKE_xerbla( "LAPACKE_dpbrfs_work", info );
128 }
129 } else {
130 info = -1;
131 LAPACKE_xerbla( "LAPACKE_dpbrfs_work", info );
132 }
133 return info;
134}
#define lapack_int
Definition lapack.h:83
#define LAPACK_dpbrfs(...)
Definition lapack.h:12001
#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 MAX(x, y)
void LAPACKE_dpb_trans(int matrix_layout, char uplo, lapack_int n, lapack_int kd, const double *in, lapack_int ldin, double *out, lapack_int ldout)
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