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

◆ LAPACKE_dsbgv_work()

lapack_int LAPACKE_dsbgv_work ( int  matrix_layout,
char  jobz,
char  uplo,
lapack_int  n,
lapack_int  ka,
lapack_int  kb,
double *  ab,
lapack_int  ldab,
double *  bb,
lapack_int  ldbb,
double *  w,
double *  z,
lapack_int  ldz,
double *  work 
)

Definition at line 35 of file lapacke_dsbgv_work.c.

40{
41 lapack_int info = 0;
42 if( matrix_layout == LAPACK_COL_MAJOR ) {
43 /* Call LAPACK function and adjust info */
44 LAPACK_dsbgv( &jobz, &uplo, &n, &ka, &kb, ab, &ldab, bb, &ldbb, w, z,
45 &ldz, 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 ldz_t = MAX(1,n);
53 double* ab_t = NULL;
54 double* bb_t = NULL;
55 double* z_t = NULL;
56 /* Check leading dimension(s) */
57 if( ldab < n ) {
58 info = -8;
59 LAPACKE_xerbla( "LAPACKE_dsbgv_work", info );
60 return info;
61 }
62 if( ldbb < n ) {
63 info = -10;
64 LAPACKE_xerbla( "LAPACKE_dsbgv_work", info );
65 return info;
66 }
67 if( ldz < n ) {
68 info = -13;
69 LAPACKE_xerbla( "LAPACKE_dsbgv_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( jobz, 'v' ) ) {
84 z_t = (double*)LAPACKE_malloc( sizeof(double) * ldz_t * MAX(1,n) );
85 if( z_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_dsbgv( &jobz, &uplo, &n, &ka, &kb, ab_t, &ldab_t, bb_t, &ldbb_t,
95 w, z_t, &ldz_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 LAPACKE_dsb_trans( LAPACK_COL_MAJOR, uplo, n, kb, bb_t, ldbb_t, bb,
103 ldbb );
104 if( LAPACKE_lsame( jobz, 'v' ) ) {
105 LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, z_t, ldz_t, z, ldz );
106 }
107 /* Release memory and exit */
108 if( LAPACKE_lsame( jobz, 'v' ) ) {
109 LAPACKE_free( z_t );
110 }
111exit_level_2:
112 LAPACKE_free( bb_t );
113exit_level_1:
114 LAPACKE_free( ab_t );
115exit_level_0:
116 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
117 LAPACKE_xerbla( "LAPACKE_dsbgv_work", info );
118 }
119 } else {
120 info = -1;
121 LAPACKE_xerbla( "LAPACKE_dsbgv_work", info );
122 }
123 return info;
124}
#define LAPACK_dsbgv(...)
Definition: lapack.h:15038
#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
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
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)
Definition: lapacke_utils.h:46
void LAPACKE_dge_trans(int matrix_layout, lapack_int m, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
Here is the call graph for this function:
Here is the caller graph for this function: