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

Go to the source code of this file.

Functions

lapack_int LAPACKE_zhbgvx_work (int matrix_layout, char jobz, char range, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_double *ab, lapack_int ldab, lapack_complex_double *bb, lapack_int ldbb, lapack_complex_double *q, lapack_int ldq, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int *m, double *w, lapack_complex_double *z, lapack_int ldz, lapack_complex_double *work, double *rwork, lapack_int *iwork, lapack_int *ifail)

Function Documentation

◆ LAPACKE_zhbgvx_work()

lapack_int LAPACKE_zhbgvx_work ( int matrix_layout,
char jobz,
char range,
char uplo,
lapack_int n,
lapack_int ka,
lapack_int kb,
lapack_complex_double * ab,
lapack_int ldab,
lapack_complex_double * bb,
lapack_int ldbb,
lapack_complex_double * q,
lapack_int ldq,
double vl,
double vu,
lapack_int il,
lapack_int iu,
double abstol,
lapack_int * m,
double * w,
lapack_complex_double * z,
lapack_int ldz,
lapack_complex_double * work,
double * rwork,
lapack_int * iwork,
lapack_int * ifail )

Definition at line 35 of file lapacke_zhbgvx_work.c.

46{
47 lapack_int info = 0;
48 if( matrix_layout == LAPACK_COL_MAJOR ) {
49 /* Call LAPACK function and adjust info */
50 LAPACK_zhbgvx( &jobz, &range, &uplo, &n, &ka, &kb, ab, &ldab, bb, &ldbb,
51 q, &ldq, &vl, &vu, &il, &iu, &abstol, m, w, z, &ldz,
52 work, rwork, iwork, ifail, &info );
53 if( info < 0 ) {
54 info = info - 1;
55 }
56 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
57 lapack_int ldab_t = MAX(1,ka+1);
58 lapack_int ldbb_t = MAX(1,kb+1);
59 lapack_int ldq_t = MAX(1,n);
60 lapack_int ldz_t = MAX(1,n);
61 lapack_complex_double* ab_t = NULL;
62 lapack_complex_double* bb_t = NULL;
63 lapack_complex_double* q_t = NULL;
64 lapack_complex_double* z_t = NULL;
65 /* Check leading dimension(s) */
66 if( ldab < n ) {
67 info = -9;
68 LAPACKE_xerbla( "LAPACKE_zhbgvx_work", info );
69 return info;
70 }
71 if( ldbb < n ) {
72 info = -11;
73 LAPACKE_xerbla( "LAPACKE_zhbgvx_work", info );
74 return info;
75 }
76 if( ldq < n ) {
77 info = -13;
78 LAPACKE_xerbla( "LAPACKE_zhbgvx_work", info );
79 return info;
80 }
81 if( ldz < n ) {
82 info = -22;
83 LAPACKE_xerbla( "LAPACKE_zhbgvx_work", info );
84 return info;
85 }
86 /* Allocate memory for temporary array(s) */
87 ab_t = (lapack_complex_double*)
88 LAPACKE_malloc( sizeof(lapack_complex_double) * ldab_t * MAX(1,n) );
89 if( ab_t == NULL ) {
91 goto exit_level_0;
92 }
93 bb_t = (lapack_complex_double*)
94 LAPACKE_malloc( sizeof(lapack_complex_double) * ldbb_t * MAX(1,n) );
95 if( bb_t == NULL ) {
97 goto exit_level_1;
98 }
99 if( LAPACKE_lsame( jobz, 'v' ) ) {
100 q_t = (lapack_complex_double*)
102 ldq_t * MAX(1,n) );
103 if( q_t == NULL ) {
105 goto exit_level_2;
106 }
107 }
108 if( LAPACKE_lsame( jobz, 'v' ) ) {
109 z_t = (lapack_complex_double*)
111 ldz_t * MAX(1,n) );
112 if( z_t == NULL ) {
114 goto exit_level_3;
115 }
116 }
117 /* Transpose input matrices */
118 LAPACKE_zhb_trans( matrix_layout, uplo, n, ka, ab, ldab, ab_t, ldab_t );
119 LAPACKE_zhb_trans( matrix_layout, uplo, n, kb, bb, ldbb, bb_t, ldbb_t );
120 /* Call LAPACK function and adjust info */
121 LAPACK_zhbgvx( &jobz, &range, &uplo, &n, &ka, &kb, ab_t, &ldab_t, bb_t,
122 &ldbb_t, q_t, &ldq_t, &vl, &vu, &il, &iu, &abstol, m, w,
123 z_t, &ldz_t, work, rwork, iwork, ifail, &info );
124 if( info < 0 ) {
125 info = info - 1;
126 }
127 /* Transpose output matrices */
128 LAPACKE_zhb_trans( LAPACK_COL_MAJOR, uplo, n, ka, ab_t, ldab_t, ab,
129 ldab );
130 LAPACKE_zhb_trans( LAPACK_COL_MAJOR, uplo, n, kb, bb_t, ldbb_t, bb,
131 ldbb );
132 if( LAPACKE_lsame( jobz, 'v' ) ) {
133 LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, q_t, ldq_t, q, ldq );
134 }
135 if( LAPACKE_lsame( jobz, 'v' ) ) {
136 LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, z_t, ldz_t, z, ldz );
137 }
138 /* Release memory and exit */
139 if( LAPACKE_lsame( jobz, 'v' ) ) {
140 LAPACKE_free( z_t );
141 }
142exit_level_3:
143 if( LAPACKE_lsame( jobz, 'v' ) ) {
144 LAPACKE_free( q_t );
145 }
146exit_level_2:
147 LAPACKE_free( bb_t );
148exit_level_1:
149 LAPACKE_free( ab_t );
150exit_level_0:
151 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
152 LAPACKE_xerbla( "LAPACKE_zhbgvx_work", info );
153 }
154 } else {
155 info = -1;
156 LAPACKE_xerbla( "LAPACKE_zhbgvx_work", info );
157 }
158 return info;
159}
#define lapack_int
Definition lapack.h:83
#define lapack_complex_double
Definition lapack.h:63
#define LAPACK_zhbgvx(...)
Definition lapack.h:6557
#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_zge_trans(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_double *in, lapack_int ldin, lapack_complex_double *out, lapack_int ldout)
#define MAX(x, y)
void LAPACKE_zhb_trans(int matrix_layout, char uplo, lapack_int n, lapack_int kd, const lapack_complex_double *in, lapack_int ldin, lapack_complex_double *out, lapack_int ldout)
n