LAPACK  3.9.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dstegr_work()

lapack_int LAPACKE_dstegr_work ( int  matrix_layout,
char  jobz,
char  range,
lapack_int  n,
double *  d,
double *  e,
double  vl,
double  vu,
lapack_int  il,
lapack_int  iu,
double  abstol,
lapack_int m,
double *  w,
double *  z,
lapack_int  ldz,
lapack_int isuppz,
double *  work,
lapack_int  lwork,
lapack_int iwork,
lapack_int  liwork 
)

Definition at line 35 of file lapacke_dstegr_work.c.

42 {
43  lapack_int info = 0;
44  if( matrix_layout == LAPACK_COL_MAJOR ) {
45  /* Call LAPACK function and adjust info */
46  LAPACK_dstegr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, &abstol, m,
47  w, z, &ldz, isuppz, work, &lwork, iwork, &liwork,
48  &info );
49  if( info < 0 ) {
50  info = info - 1;
51  }
52  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
53  lapack_int ldz_t = MAX(1,n);
54  double* z_t = NULL;
55  /* Check leading dimension(s) */
56  if( ( LAPACKE_lsame( jobz, 'v' ) && ( ldz < ldz_t ) ) || ( ldz < 1 ) ) {
57  info = -15;
58  LAPACKE_xerbla( "LAPACKE_dstegr_work", info );
59  return info;
60  }
61  /* Query optimal working array(s) size if requested */
62  if( liwork == -1 || lwork == -1 ) {
63  LAPACK_dstegr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, &abstol,
64  m, w, z, &ldz_t, isuppz, work, &lwork, iwork,
65  &liwork, &info );
66  return (info < 0) ? (info - 1) : info;
67  }
68  /* Allocate memory for temporary array(s) */
69  if( LAPACKE_lsame( jobz, 'v' ) ) {
70  /* Let be always 'n' instead of 'm' */
71  z_t = (double*)LAPACKE_malloc( sizeof(double) * ldz_t * MAX(1,n) );
72  if( z_t == NULL ) {
74  goto exit_level_0;
75  }
76  }
77  /* Call LAPACK function and adjust info */
78  LAPACK_dstegr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, &abstol, m,
79  w, z_t, &ldz_t, isuppz, work, &lwork, iwork, &liwork,
80  &info );
81  if( info < 0 ) {
82  info = info - 1;
83  }
84  /* Transpose output matrices */
85  if( LAPACKE_lsame( jobz, 'v' ) ) {
86  LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, *m, z_t, ldz_t, z, ldz );
87  }
88  /* Release memory and exit */
89  if( LAPACKE_lsame( jobz, 'v' ) ) {
90  LAPACKE_free( z_t );
91  }
92 exit_level_0:
93  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
94  LAPACKE_xerbla( "LAPACKE_dstegr_work", info );
95  }
96  } else {
97  info = -1;
98  LAPACKE_xerbla( "LAPACKE_dstegr_work", info );
99  }
100  return info;
101 }
#define lapack_int
Definition: lapack.h:83
void LAPACK_dstegr(char const *jobz, char const *range, lapack_int const *n, double *D, double *E, double const *vl, double const *vu, lapack_int const *il, lapack_int const *iu, double const *abstol, lapack_int *m, double *W, double *Z, lapack_int const *ldz, lapack_int *ISUPPZ, double *work, lapack_int const *lwork, lapack_int *iwork, lapack_int const *liwork, lapack_int *info)
#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)
#define MAX(x, y)
Definition: lapacke_utils.h:46
void LAPACKE_dge_trans(int matrix_layout, lapack_int m, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
Here is the call graph for this function:
Here is the caller graph for this function: