LAPACK  3.7.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_zhpev_work()

lapack_int LAPACKE_zhpev_work ( int  matrix_layout,
char  jobz,
char  uplo,
lapack_int  n,
lapack_complex_double ap,
double *  w,
lapack_complex_double z,
lapack_int  ldz,
lapack_complex_double work,
double *  rwork 
)

Definition at line 36 of file lapacke_zhpev_work.c.

41 {
42  lapack_int info = 0;
43  if( matrix_layout == LAPACK_COL_MAJOR ) {
44  /* Call LAPACK function and adjust info */
45  LAPACK_zhpev( &jobz, &uplo, &n, ap, w, z, &ldz, work, rwork, &info );
46  if( info < 0 ) {
47  info = info - 1;
48  }
49  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
50  lapack_int ldz_t = MAX(1,n);
51  lapack_complex_double* z_t = NULL;
52  lapack_complex_double* ap_t = NULL;
53  /* Check leading dimension(s) */
54  if( ldz < n ) {
55  info = -8;
56  LAPACKE_xerbla( "LAPACKE_zhpev_work", info );
57  return info;
58  }
59  /* Allocate memory for temporary array(s) */
60  if( LAPACKE_lsame( jobz, 'v' ) ) {
61  z_t = (lapack_complex_double*)
63  ldz_t * MAX(1,n) );
64  if( z_t == NULL ) {
66  goto exit_level_0;
67  }
68  }
69  ap_t = (lapack_complex_double*)
71  ( MAX(1,n) * MAX(2,n+1) ) / 2 );
72  if( ap_t == NULL ) {
74  goto exit_level_1;
75  }
76  /* Transpose input matrices */
77  LAPACKE_zhp_trans( matrix_layout, uplo, n, ap, ap_t );
78  /* Call LAPACK function and adjust info */
79  LAPACK_zhpev( &jobz, &uplo, &n, ap_t, w, z_t, &ldz_t, work, rwork,
80  &info );
81  if( info < 0 ) {
82  info = info - 1;
83  }
84  /* Transpose output matrices */
85  if( LAPACKE_lsame( jobz, 'v' ) ) {
86  LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, z_t, ldz_t, z, ldz );
87  }
88  LAPACKE_zhp_trans( LAPACK_COL_MAJOR, uplo, n, ap_t, ap );
89  /* Release memory and exit */
90  LAPACKE_free( ap_t );
91 exit_level_1:
92  if( LAPACKE_lsame( jobz, 'v' ) ) {
93  LAPACKE_free( z_t );
94  }
95 exit_level_0:
96  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
97  LAPACKE_xerbla( "LAPACKE_zhpev_work", info );
98  }
99  } else {
100  info = -1;
101  LAPACKE_xerbla( "LAPACKE_zhpev_work", info );
102  }
103  return info;
104 }
#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 LAPACKE_zhp_trans(int matrix_layout, char uplo, lapack_int n, const lapack_complex_double *in, lapack_complex_double *out)
void LAPACK_zhpev(char *jobz, char *uplo, lapack_int *n, lapack_complex_double *ap, double *w, lapack_complex_double *z, lapack_int *ldz, lapack_complex_double *work, double *rwork, 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)
#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: