LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_ssygvx_work ( int  matrix_layout,
lapack_int  itype,
char  jobz,
char  range,
char  uplo,
lapack_int  n,
float *  a,
lapack_int  lda,
float *  b,
lapack_int  ldb,
float  vl,
float  vu,
lapack_int  il,
lapack_int  iu,
float  abstol,
lapack_int m,
float *  w,
float *  z,
lapack_int  ldz,
float *  work,
lapack_int  lwork,
lapack_int iwork,
lapack_int ifail 
)

Definition at line 36 of file lapacke_ssygvx_work.c.

44 {
45  lapack_int info = 0;
46  if( matrix_layout == LAPACK_COL_MAJOR ) {
47  /* Call LAPACK function and adjust info */
48  LAPACK_ssygvx( &itype, &jobz, &range, &uplo, &n, a, &lda, b, &ldb, &vl,
49  &vu, &il, &iu, &abstol, m, w, z, &ldz, work, &lwork,
50  iwork, ifail, &info );
51  if( info < 0 ) {
52  info = info - 1;
53  }
54  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
55  lapack_int ncols_z = ( LAPACKE_lsame( range, 'a' ) ||
56  LAPACKE_lsame( range, 'v' ) ) ? n :
57  ( LAPACKE_lsame( range, 'i' ) ? (iu-il+1) : 1);
58  lapack_int lda_t = MAX(1,n);
59  lapack_int ldb_t = MAX(1,n);
60  lapack_int ldz_t = MAX(1,n);
61  float* a_t = NULL;
62  float* b_t = NULL;
63  float* z_t = NULL;
64  /* Check leading dimension(s) */
65  if( lda < n ) {
66  info = -8;
67  LAPACKE_xerbla( "LAPACKE_ssygvx_work", info );
68  return info;
69  }
70  if( ldb < n ) {
71  info = -10;
72  LAPACKE_xerbla( "LAPACKE_ssygvx_work", info );
73  return info;
74  }
75  if( ldz < ncols_z ) {
76  info = -19;
77  LAPACKE_xerbla( "LAPACKE_ssygvx_work", info );
78  return info;
79  }
80  /* Query optimal working array(s) size if requested */
81  if( lwork == -1 ) {
82  LAPACK_ssygvx( &itype, &jobz, &range, &uplo, &n, a, &lda_t, b,
83  &ldb_t, &vl, &vu, &il, &iu, &abstol, m, w, z, &ldz_t,
84  work, &lwork, iwork, ifail, &info );
85  return (info < 0) ? (info - 1) : info;
86  }
87  /* Allocate memory for temporary array(s) */
88  a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,n) );
89  if( a_t == NULL ) {
91  goto exit_level_0;
92  }
93  b_t = (float*)LAPACKE_malloc( sizeof(float) * ldb_t * MAX(1,n) );
94  if( b_t == NULL ) {
96  goto exit_level_1;
97  }
98  if( LAPACKE_lsame( jobz, 'v' ) ) {
99  z_t = (float*)
100  LAPACKE_malloc( sizeof(float) * ldz_t * MAX(1,ncols_z) );
101  if( z_t == NULL ) {
103  goto exit_level_2;
104  }
105  }
106  /* Transpose input matrices */
107  LAPACKE_ssy_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
108  LAPACKE_sge_trans( matrix_layout, n, n, b, ldb, b_t, ldb_t );
109  /* Call LAPACK function and adjust info */
110  LAPACK_ssygvx( &itype, &jobz, &range, &uplo, &n, a_t, &lda_t, b_t,
111  &ldb_t, &vl, &vu, &il, &iu, &abstol, m, w, z_t, &ldz_t,
112  work, &lwork, iwork, ifail, &info );
113  if( info < 0 ) {
114  info = info - 1;
115  }
116  /* Transpose output matrices */
117  LAPACKE_ssy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
118  LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, b_t, ldb_t, b, ldb );
119  if( LAPACKE_lsame( jobz, 'v' ) ) {
120  LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, ncols_z, z_t, ldz_t, z,
121  ldz );
122  }
123  /* Release memory and exit */
124  if( LAPACKE_lsame( jobz, 'v' ) ) {
125  LAPACKE_free( z_t );
126  }
127 exit_level_2:
128  LAPACKE_free( b_t );
129 exit_level_1:
130  LAPACKE_free( a_t );
131 exit_level_0:
132  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
133  LAPACKE_xerbla( "LAPACKE_ssygvx_work", info );
134  }
135  } else {
136  info = -1;
137  LAPACKE_xerbla( "LAPACKE_ssygvx_work", info );
138  }
139  return info;
140 }
void LAPACKE_ssy_trans(int matrix_layout, char uplo, lapack_int n, const float *in, lapack_int ldin, float *out, lapack_int ldout)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
void LAPACK_ssygvx(lapack_int *itype, char *jobz, char *range, char *uplo, lapack_int *n, float *a, lapack_int *lda, float *b, lapack_int *ldb, float *vl, float *vu, lapack_int *il, lapack_int *iu, float *abstol, lapack_int *m, float *w, float *z, lapack_int *ldz, float *work, lapack_int *lwork, lapack_int *iwork, lapack_int *ifail, lapack_int *info)
void LAPACKE_sge_trans(int matrix_layout, lapack_int m, lapack_int n, const float *in, lapack_int ldin, float *out, lapack_int ldout)
#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
#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: