LAPACK  3.7.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_cheevr_2stage_work()

lapack_int LAPACKE_cheevr_2stage_work ( int  matrix_layout,
char  jobz,
char  range,
char  uplo,
lapack_int  n,
lapack_complex_float a,
lapack_int  lda,
float  vl,
float  vu,
lapack_int  il,
lapack_int  iu,
float  abstol,
lapack_int m,
float *  w,
lapack_complex_float z,
lapack_int  ldz,
lapack_int isuppz,
lapack_complex_float work,
lapack_int  lwork,
float *  rwork,
lapack_int  lrwork,
lapack_int iwork,
lapack_int  liwork 
)

Definition at line 36 of file lapacke_cheevr_2stage_work.c.

46 {
47  lapack_int info = 0;
48  if( matrix_layout == LAPACK_COL_MAJOR ) {
49  /* Call LAPACK function and adjust info */
50  LAPACK_cheevr_2stage( &jobz, &range, &uplo, &n, a, &lda, &vl, &vu, &il, &iu,
51  &abstol, m, w, z, &ldz, isuppz, work, &lwork, rwork,
52  &lrwork, iwork, &liwork, &info );
53  if( info < 0 ) {
54  info = info - 1;
55  }
56  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
57  lapack_int ncols_z = ( 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_float* a_t = NULL;
63  lapack_complex_float* z_t = NULL;
64  /* Check leading dimension(s) */
65  if( lda < n ) {
66  info = -7;
67  LAPACKE_xerbla( "LAPACKE_cheevr_2stage_work", info );
68  return info;
69  }
70  if( ldz < ncols_z ) {
71  info = -16;
72  LAPACKE_xerbla( "LAPACKE_cheevr_2stage_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_cheevr_2stage( &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) */
83  a_t = (lapack_complex_float*)
84  LAPACKE_malloc( sizeof(lapack_complex_float) * 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_float*)
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_che_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
100  /* Call LAPACK function and adjust info */
101  LAPACK_cheevr_2stage( &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_che_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
109  if( LAPACKE_lsame( jobz, 'v' ) ) {
110  LAPACKE_cge_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_cheevr_2stage_work", info );
122  }
123  } else {
124  info = -1;
125  LAPACKE_xerbla( "LAPACKE_cheevr_2stage_work", info );
126  }
127  return info;
128 }
void LAPACKE_che_trans(int matrix_layout, char uplo, lapack_int n, const lapack_complex_float *in, lapack_int ldin, lapack_complex_float *out, lapack_int ldout)
void LAPACKE_cge_trans(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_float *in, lapack_int ldin, lapack_complex_float *out, lapack_int ldout)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACKE_free(p)
Definition: lapacke.h:113
#define lapack_complex_float
Definition: lapacke.h:74
#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 LAPACK_cheevr_2stage(char *jobz, char *range, char *uplo, lapack_int *n, lapack_complex_float *a, lapack_int *lda, float *vl, float *vu, lapack_int *il, lapack_int *iu, float *abstol, lapack_int *m, float *w, lapack_complex_float *z, lapack_int *ldz, lapack_int *isuppz, lapack_complex_float *work, lapack_int *lwork, float *rwork, lapack_int *lrwork, lapack_int *iwork, lapack_int *liwork, lapack_int *info)
Here is the call graph for this function:
Here is the caller graph for this function: