LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_zhbev_2stage_work()

lapack_int LAPACKE_zhbev_2stage_work ( int  matrix_layout,
char  jobz,
char  uplo,
lapack_int  n,
lapack_int  kd,
lapack_complex_double ab,
lapack_int  ldab,
double *  w,
lapack_complex_double z,
lapack_int  ldz,
lapack_complex_double work,
lapack_int  lwork,
double *  rwork 
)

Definition at line 35 of file lapacke_zhbev_2stage_work.c.

41 {
42  lapack_int info = 0;
43  if( matrix_layout == LAPACK_COL_MAJOR ) {
44  /* Call LAPACK function and adjust info */
45  LAPACK_zhbev_2stage( &jobz, &uplo, &n, &kd, ab, &ldab, w, z, &ldz, work, &lwork,
46  rwork, &info );
47  if( info < 0 ) {
48  info = info - 1;
49  }
50  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
51  lapack_int ldab_t = MAX(1,kd+1);
52  lapack_int ldz_t = MAX(1,n);
53  lapack_complex_double* ab_t = NULL;
54  lapack_complex_double* z_t = NULL;
55  /* Check leading dimension(s) */
56  if( ldab < n ) {
57  info = -7;
58  LAPACKE_xerbla( "LAPACKE_zhbev_2stage_work", info );
59  return info;
60  }
61  if( ldz < n ) {
62  info = -10;
63  LAPACKE_xerbla( "LAPACKE_zhbev_2stage_work", info );
64  return info;
65  }
66  /* Query optimal working array(s) size if requested */
67  if( lwork == -1 ) {
68  LAPACK_zhbev_2stage( &jobz, &uplo, &n, &kd, ab_t, &ldab_t, w, z_t, &ldz_t,
69  work, &lwork, rwork, &info );
70  return (info < 0) ? (info - 1) : info;
71  }
72  /* Allocate memory for temporary array(s) */
73  ab_t = (lapack_complex_double*)
74  LAPACKE_malloc( sizeof(lapack_complex_double) * ldab_t * MAX(1,n) );
75  if( ab_t == NULL ) {
77  goto exit_level_0;
78  }
79  if( LAPACKE_lsame( jobz, 'v' ) ) {
80  z_t = (lapack_complex_double*)
82  ldz_t * MAX(1,n) );
83  if( z_t == NULL ) {
85  goto exit_level_1;
86  }
87  }
88  /* Transpose input matrices */
89  LAPACKE_zhb_trans( matrix_layout, uplo, n, kd, ab, ldab, ab_t, ldab_t );
90  /* Call LAPACK function and adjust info */
91  LAPACK_zhbev_2stage( &jobz, &uplo, &n, &kd, ab_t, &ldab_t, w, z_t, &ldz_t,
92  work, &lwork, rwork, &info );
93  if( info < 0 ) {
94  info = info - 1;
95  }
96  /* Transpose output matrices */
97  LAPACKE_zhb_trans( LAPACK_COL_MAJOR, uplo, n, kd, ab_t, ldab_t, ab,
98  ldab );
99  if( LAPACKE_lsame( jobz, 'v' ) ) {
100  LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, z_t, ldz_t, z, ldz );
101  }
102  /* Release memory and exit */
103  if( LAPACKE_lsame( jobz, 'v' ) ) {
104  LAPACKE_free( z_t );
105  }
106 exit_level_1:
107  LAPACKE_free( ab_t );
108 exit_level_0:
109  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
110  LAPACKE_xerbla( "LAPACKE_zhbev_2stage_work", info );
111  }
112  } else {
113  info = -1;
114  LAPACKE_xerbla( "LAPACKE_zhbev_2stage_work", info );
115  }
116  return info;
117 }
#define lapack_int
Definition: lapack.h:83
#define LAPACK_zhbev_2stage(...)
Definition: lapack.h:6195
#define lapack_complex_double
Definition: lapack.h:63
#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)
#define MAX(x, y)
Definition: lapacke_utils.h:46
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)
Here is the call graph for this function:
Here is the caller graph for this function: