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

◆ LAPACKE_zheevr_work()

lapack_int LAPACKE_zheevr_work ( int  matrix_layout,
char  jobz,
char  range,
char  uplo,
lapack_int  n,
lapack_complex_double a,
lapack_int  lda,
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_int isuppz,
lapack_complex_double work,
lapack_int  lwork,
double *  rwork,
lapack_int  lrwork,
lapack_int iwork,
lapack_int  liwork 
)

Definition at line 35 of file lapacke_zheevr_work.c.

45{
46 lapack_int info = 0;
47 if( matrix_layout == LAPACK_COL_MAJOR ) {
48 /* Call LAPACK function and adjust info */
49 LAPACK_zheevr( &jobz, &range, &uplo, &n, a, &lda, &vl, &vu, &il, &iu,
50 &abstol, m, w, z, &ldz, isuppz, work, &lwork, rwork,
51 &lrwork, iwork, &liwork, &info );
52 if( info < 0 ) {
53 info = info - 1;
54 }
55 } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
56 lapack_int ncols_z = ( !LAPACKE_lsame( jobz, 'v' ) ) ? 1 :
57 ( LAPACKE_lsame( range, 'a' ) ||
58 LAPACKE_lsame( range, 'v' ) ) ? n :
59 ( LAPACKE_lsame( range, 'i' ) ? (iu-il+1) : 1);
60 lapack_int lda_t = MAX(1,n);
61 lapack_int ldz_t = MAX(1,n);
62 lapack_complex_double* a_t = NULL;
63 lapack_complex_double* z_t = NULL;
64 /* Check leading dimension(s) */
65 if( lda < n ) {
66 info = -7;
67 LAPACKE_xerbla( "LAPACKE_zheevr_work", info );
68 return info;
69 }
70 if( ldz < ncols_z ) {
71 info = -16;
72 LAPACKE_xerbla( "LAPACKE_zheevr_work", info );
73 return info;
74 }
75 /* Query optimal working array(s) size if requested */
76 if( liwork == -1 || lrwork == -1 || lwork == -1 ) {
77 LAPACK_zheevr( &jobz, &range, &uplo, &n, a, &lda_t, &vl, &vu, &il,
78 &iu, &abstol, m, w, z, &ldz_t, isuppz, work, &lwork,
79 rwork, &lrwork, iwork, &liwork, &info );
80 return (info < 0) ? (info - 1) : info;
81 }
82 /* Allocate memory for temporary array(s) */
84 LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) );
85 if( a_t == NULL ) {
87 goto exit_level_0;
88 }
89 if( LAPACKE_lsame( jobz, 'v' ) ) {
92 ldz_t * MAX(1,ncols_z) );
93 if( z_t == NULL ) {
95 goto exit_level_1;
96 }
97 }
98 /* Transpose input matrices */
99 LAPACKE_zhe_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
100 /* Call LAPACK function and adjust info */
101 LAPACK_zheevr( &jobz, &range, &uplo, &n, a_t, &lda_t, &vl, &vu, &il,
102 &iu, &abstol, m, w, z_t, &ldz_t, isuppz, work, &lwork,
103 rwork, &lrwork, iwork, &liwork, &info );
104 if( info < 0 ) {
105 info = info - 1;
106 }
107 /* Transpose output matrices */
108 LAPACKE_zhe_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
109 if( LAPACKE_lsame( jobz, 'v' ) ) {
110 LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, ncols_z, z_t, ldz_t, z,
111 ldz );
112 }
113 /* Release memory and exit */
114 if( LAPACKE_lsame( jobz, 'v' ) ) {
115 LAPACKE_free( z_t );
116 }
117exit_level_1:
118 LAPACKE_free( a_t );
119exit_level_0:
120 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
121 LAPACKE_xerbla( "LAPACKE_zheevr_work", info );
122 }
123 } else {
124 info = -1;
125 LAPACKE_xerbla( "LAPACKE_zheevr_work", info );
126 }
127 return info;
128}
#define lapack_int
Definition: lapack.h:87
#define lapack_complex_double
Definition: lapack.h:64
#define LAPACK_zheevr(...)
Definition: lapack.h:6935
#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_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)
void LAPACKE_zhe_trans(int matrix_layout, char uplo, lapack_int n, const lapack_complex_double *in, lapack_int ldin, lapack_complex_double *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: