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

Go to the source code of this file.

Functions

lapack_int LAPACKE_dsbgst_work (int matrix_layout, char vect, char uplo, lapack_int n, lapack_int ka, lapack_int kb, double *ab, lapack_int ldab, const double *bb, lapack_int ldbb, double *x, lapack_int ldx, double *work)

Function Documentation

◆ LAPACKE_dsbgst_work()

lapack_int LAPACKE_dsbgst_work ( int matrix_layout,
char vect,
char uplo,
lapack_int n,
lapack_int ka,
lapack_int kb,
double * ab,
lapack_int ldab,
const double * bb,
lapack_int ldbb,
double * x,
lapack_int ldx,
double * work )

Definition at line 35 of file lapacke_dsbgst_work.c.

40{
41 lapack_int info = 0;
42 if( matrix_layout == LAPACK_COL_MAJOR ) {
43 /* Call LAPACK function and adjust info */
44 LAPACK_dsbgst( &vect, &uplo, &n, &ka, &kb, ab, &ldab, bb, &ldbb, x,
45 &ldx, work, &info );
46 if( info < 0 ) {
47 info = info - 1;
48 }
49 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
50 lapack_int ldab_t = MAX(1,ka+1);
51 lapack_int ldbb_t = MAX(1,kb+1);
52 lapack_int ldx_t = MAX(1,n);
53 double* ab_t = NULL;
54 double* bb_t = NULL;
55 double* x_t = NULL;
56 /* Check leading dimension(s) */
57 if( ldab < n ) {
58 info = -8;
59 LAPACKE_xerbla( "LAPACKE_dsbgst_work", info );
60 return info;
61 }
62 if( ldbb < n ) {
63 info = -10;
64 LAPACKE_xerbla( "LAPACKE_dsbgst_work", info );
65 return info;
66 }
67 if( ldx < n ) {
68 info = -12;
69 LAPACKE_xerbla( "LAPACKE_dsbgst_work", info );
70 return info;
71 }
72 /* Allocate memory for temporary array(s) */
73 ab_t = (double*)LAPACKE_malloc( sizeof(double) * ldab_t * MAX(1,n) );
74 if( ab_t == NULL ) {
76 goto exit_level_0;
77 }
78 bb_t = (double*)LAPACKE_malloc( sizeof(double) * ldbb_t * MAX(1,n) );
79 if( bb_t == NULL ) {
81 goto exit_level_1;
82 }
83 if( LAPACKE_lsame( vect, 'v' ) ) {
84 x_t = (double*)LAPACKE_malloc( sizeof(double) * ldx_t * MAX(1,n) );
85 if( x_t == NULL ) {
87 goto exit_level_2;
88 }
89 }
90 /* Transpose input matrices */
91 LAPACKE_dsb_trans( matrix_layout, uplo, n, ka, ab, ldab, ab_t, ldab_t );
92 LAPACKE_dsb_trans( matrix_layout, uplo, n, kb, bb, ldbb, bb_t, ldbb_t );
93 /* Call LAPACK function and adjust info */
94 LAPACK_dsbgst( &vect, &uplo, &n, &ka, &kb, ab_t, &ldab_t, bb_t, &ldbb_t,
95 x_t, &ldx_t, work, &info );
96 if( info < 0 ) {
97 info = info - 1;
98 }
99 /* Transpose output matrices */
100 LAPACKE_dsb_trans( LAPACK_COL_MAJOR, uplo, n, ka, ab_t, ldab_t, ab,
101 ldab );
102 if( LAPACKE_lsame( vect, 'v' ) ) {
103 LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, x_t, ldx_t, x, ldx );
104 }
105 /* Release memory and exit */
106 if( LAPACKE_lsame( vect, 'v' ) ) {
107 LAPACKE_free( x_t );
108 }
109exit_level_2:
110 LAPACKE_free( bb_t );
111exit_level_1:
112 LAPACKE_free( ab_t );
113exit_level_0:
114 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
115 LAPACKE_xerbla( "LAPACKE_dsbgst_work", info );
116 }
117 } else {
118 info = -1;
119 LAPACKE_xerbla( "LAPACKE_dsbgst_work", info );
120 }
121 return info;
122}
#define lapack_int
Definition lapack.h:83
#define LAPACK_dsbgst(...)
Definition lapack.h:14983
#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)
void LAPACKE_dsb_trans(int matrix_layout, char uplo, lapack_int n, lapack_int kd, const double *in, lapack_int ldin, double *out, lapack_int ldout)
#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)
n