LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_zheevx_work()

lapack_int LAPACKE_zheevx_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_complex_double work,
lapack_int  lwork,
double *  rwork,
lapack_int iwork,
lapack_int ifail 
)

Definition at line 36 of file lapacke_zheevx_work.c.

45 {
46  lapack_int info = 0;
47  if( matrix_layout == LAPACK_COL_MAJOR ) {
48  /* Call LAPACK function and adjust info */
49  LAPACK_zheevx( &jobz, &range, &uplo, &n, a, &lda, &vl, &vu, &il, &iu,
50  &abstol, m, w, z, &ldz, work, &lwork, rwork, iwork,
51  ifail, &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_zheevx_work", info );
68  return info;
69  }
70  if( ldz < ncols_z ) {
71  info = -16;
72  LAPACKE_xerbla( "LAPACKE_zheevx_work", info );
73  return info;
74  }
75  /* Query optimal working array(s) size if requested */
76  if( lwork == -1 ) {
77  LAPACK_zheevx( &jobz, &range, &uplo, &n, a, &lda_t, &vl, &vu, &il,
78  &iu, &abstol, m, w, z, &ldz_t, work, &lwork, rwork,
79  iwork, ifail, &info );
80  return (info < 0) ? (info - 1) : info;
81  }
82  /* Allocate memory for temporary array(s) */
83  a_t = (lapack_complex_double*)
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' ) ) {
90  z_t = (lapack_complex_double*)
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_zheevx( &jobz, &range, &uplo, &n, a_t, &lda_t, &vl, &vu, &il,
102  &iu, &abstol, m, w, z_t, &ldz_t, work, &lwork, rwork,
103  iwork, ifail, &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  }
117 exit_level_1:
118  LAPACKE_free( a_t );
119 exit_level_0:
120  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
121  LAPACKE_xerbla( "LAPACKE_zheevx_work", info );
122  }
123  } else {
124  info = -1;
125  LAPACKE_xerbla( "LAPACKE_zheevx_work", info );
126  }
127  return info;
128 }
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACKE_free(p)
Definition: lapacke.h:113
#define lapack_complex_double
Definition: lapacke.h:90
void LAPACK_zheevx(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_complex_double *work, lapack_int *lwork, double *rwork, lapack_int *iwork, lapack_int *ifail, lapack_int *info)
#define MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:36
#define LAPACK_COL_MAJOR
Definition: lapacke.h:120
void LAPACKE_xerbla(const char *name, lapack_int info)
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 lapack_int
Definition: lapacke.h:47
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:123
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)
Here is the call graph for this function:
Here is the caller graph for this function: