LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ LAPACKE_ssbgst_work()

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

Definition at line 35 of file lapacke_ssbgst_work.c.

40{
41 lapack_int info = 0;
42 if( matrix_layout == LAPACK_COL_MAJOR ) {
43 /* Call LAPACK function and adjust info */
44 LAPACK_ssbgst( &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 float* ab_t = NULL;
54 float* bb_t = NULL;
55 float* x_t = NULL;
56 /* Check leading dimension(s) */
57 if( ldab < n ) {
58 info = -8;
59 LAPACKE_xerbla( "LAPACKE_ssbgst_work", info );
60 return info;
61 }
62 if( ldbb < n ) {
63 info = -10;
64 LAPACKE_xerbla( "LAPACKE_ssbgst_work", info );
65 return info;
66 }
67 if( ldx < n ) {
68 info = -12;
69 LAPACKE_xerbla( "LAPACKE_ssbgst_work", info );
70 return info;
71 }
72 /* Allocate memory for temporary array(s) */
73 ab_t = (float*)LAPACKE_malloc( sizeof(float) * ldab_t * MAX(1,n) );
74 if( ab_t == NULL ) {
76 goto exit_level_0;
77 }
78 bb_t = (float*)LAPACKE_malloc( sizeof(float) * 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 = (float*)LAPACKE_malloc( sizeof(float) * ldx_t * MAX(1,n) );
85 if( x_t == NULL ) {
87 goto exit_level_2;
88 }
89 }
90 /* Transpose input matrices */
91 LAPACKE_ssb_trans( matrix_layout, uplo, n, ka, ab, ldab, ab_t, ldab_t );
92 LAPACKE_ssb_trans( matrix_layout, uplo, n, kb, bb, ldbb, bb_t, ldbb_t );
93 /* Call LAPACK function and adjust info */
94 LAPACK_ssbgst( &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_ssb_trans( LAPACK_COL_MAJOR, uplo, n, ka, ab_t, ldab_t, ab,
101 ldab );
102 if( LAPACKE_lsame( vect, 'v' ) ) {
103 LAPACKE_sge_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_ssbgst_work", info );
116 }
117 } else {
118 info = -1;
119 LAPACKE_xerbla( "LAPACKE_ssbgst_work", info );
120 }
121 return info;
122}
#define LAPACK_ssbgst(...)
Definition: lapack.h:15018
#define lapack_int
Definition: lapack.h:87
#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_ssb_trans(int matrix_layout, char uplo, lapack_int n, lapack_int kd, const float *in, lapack_int ldin, float *out, lapack_int ldout)
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
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)
#define MAX(x, y)
Definition: lapacke_utils.h:46
Here is the call graph for this function:
Here is the caller graph for this function: