LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_dspgvx_work ( int  matrix_layout,
lapack_int  itype,
char  jobz,
char  range,
char  uplo,
lapack_int  n,
double *  ap,
double *  bp,
double  vl,
double  vu,
lapack_int  il,
lapack_int  iu,
double  abstol,
lapack_int m,
double *  w,
double *  z,
lapack_int  ldz,
double *  work,
lapack_int iwork,
lapack_int ifail 
)

Definition at line 36 of file lapacke_dspgvx_work.c.

43 {
44  lapack_int info = 0;
45  if( matrix_layout == LAPACK_COL_MAJOR ) {
46  /* Call LAPACK function and adjust info */
47  LAPACK_dspgvx( &itype, &jobz, &range, &uplo, &n, ap, bp, &vl, &vu, &il,
48  &iu, &abstol, m, w, z, &ldz, work, iwork, ifail, &info );
49  if( info < 0 ) {
50  info = info - 1;
51  }
52  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
53  lapack_int ncols_z = ( LAPACKE_lsame( range, 'a' ) ||
54  LAPACKE_lsame( range, 'v' ) ) ? n :
55  ( LAPACKE_lsame( range, 'i' ) ? (iu-il+1) : 1);
56  lapack_int ldz_t = MAX(1,n);
57  double* z_t = NULL;
58  double* ap_t = NULL;
59  double* bp_t = NULL;
60  /* Check leading dimension(s) */
61  if( ldz < ncols_z ) {
62  info = -17;
63  LAPACKE_xerbla( "LAPACKE_dspgvx_work", info );
64  return info;
65  }
66  /* Allocate memory for temporary array(s) */
67  if( LAPACKE_lsame( jobz, 'v' ) ) {
68  z_t = (double*)
69  LAPACKE_malloc( sizeof(double) * ldz_t * MAX(1,ncols_z) );
70  if( z_t == NULL ) {
72  goto exit_level_0;
73  }
74  }
75  ap_t = (double*)
76  LAPACKE_malloc( sizeof(double) * ( MAX(1,n) * MAX(2,n+1) ) / 2 );
77  if( ap_t == NULL ) {
79  goto exit_level_1;
80  }
81  bp_t = (double*)
82  LAPACKE_malloc( sizeof(double) * ( MAX(1,n) * MAX(2,n+1) ) / 2 );
83  if( bp_t == NULL ) {
85  goto exit_level_2;
86  }
87  /* Transpose input matrices */
88  LAPACKE_dsp_trans( matrix_layout, uplo, n, ap, ap_t );
89  LAPACKE_dsp_trans( matrix_layout, uplo, n, bp, bp_t );
90  /* Call LAPACK function and adjust info */
91  LAPACK_dspgvx( &itype, &jobz, &range, &uplo, &n, ap_t, bp_t, &vl, &vu,
92  &il, &iu, &abstol, m, w, z_t, &ldz_t, work, iwork, ifail,
93  &info );
94  if( info < 0 ) {
95  info = info - 1;
96  }
97  /* Transpose output matrices */
98  if( LAPACKE_lsame( jobz, 'v' ) ) {
99  LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, ncols_z, z_t, ldz_t, z,
100  ldz );
101  }
102  LAPACKE_dsp_trans( LAPACK_COL_MAJOR, uplo, n, ap_t, ap );
103  LAPACKE_dsp_trans( LAPACK_COL_MAJOR, uplo, n, bp_t, bp );
104  /* Release memory and exit */
105  LAPACKE_free( bp_t );
106 exit_level_2:
107  LAPACKE_free( ap_t );
108 exit_level_1:
109  if( LAPACKE_lsame( jobz, 'v' ) ) {
110  LAPACKE_free( z_t );
111  }
112 exit_level_0:
113  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
114  LAPACKE_xerbla( "LAPACKE_dspgvx_work", info );
115  }
116  } else {
117  info = -1;
118  LAPACKE_xerbla( "LAPACKE_dspgvx_work", info );
119  }
120  return info;
121 }
void LAPACKE_dge_trans(int matrix_layout, lapack_int m, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
void LAPACK_dspgvx(lapack_int *itype, char *jobz, char *range, char *uplo, lapack_int *n, double *ap, double *bp, double *vl, double *vu, lapack_int *il, lapack_int *iu, double *abstol, lapack_int *m, double *w, double *z, lapack_int *ldz, double *work, lapack_int *iwork, lapack_int *ifail, lapack_int *info)
#define MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACKE_free(p)
Definition: lapacke.h:113
#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
void LAPACKE_dsp_trans(int matrix_layout, char uplo, lapack_int n, const double *in, double *out)
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:123

Here is the call graph for this function:

Here is the caller graph for this function: