LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dstevr_work()

lapack_int LAPACKE_dstevr_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_dstevr_work.c.

42 {
43  lapack_int info = 0;
44  if( matrix_layout == LAPACK_COL_MAJOR ) {
45  /* Call LAPACK function and adjust info */
46  LAPACK_dstevr( &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 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  /* Check leading dimension(s) */
59  if( ldz < ncols_z ) {
60  info = -15;
61  LAPACKE_xerbla( "LAPACKE_dstevr_work", info );
62  return info;
63  }
64  /* Query optimal working array(s) size if requested */
65  if( liwork == -1 || lwork == -1 ) {
66  LAPACK_dstevr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, &abstol,
67  m, w, z, &ldz_t, isuppz, work, &lwork, iwork,
68  &liwork, &info );
69  return (info < 0) ? (info - 1) : info;
70  }
71  /* Allocate memory for temporary array(s) */
72  if( LAPACKE_lsame( jobz, 'v' ) ) {
73  z_t = (double*)
74  LAPACKE_malloc( sizeof(double) * ldz_t * MAX(1,ncols_z) );
75  if( z_t == NULL ) {
77  goto exit_level_0;
78  }
79  }
80  /* Call LAPACK function and adjust info */
81  LAPACK_dstevr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, &abstol, m,
82  w, z_t, &ldz_t, isuppz, work, &lwork, iwork, &liwork,
83  &info );
84  if( info < 0 ) {
85  info = info - 1;
86  }
87  /* Transpose output matrices */
88  if( LAPACKE_lsame( jobz, 'v' ) ) {
89  LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, ncols_z, z_t, ldz_t, z,
90  ldz );
91  }
92  /* Release memory and exit */
93  if( LAPACKE_lsame( jobz, 'v' ) ) {
94  LAPACKE_free( z_t );
95  }
96 exit_level_0:
97  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
98  LAPACKE_xerbla( "LAPACKE_dstevr_work", info );
99  }
100  } else {
101  info = -1;
102  LAPACKE_xerbla( "LAPACKE_dstevr_work", info );
103  }
104  return info;
105 }
#define LAPACK_dstevr(...)
Definition: lapack.h:16622
#define lapack_int
Definition: lapack.h:83
#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: