LAPACK  3.7.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dbdsvdx_work()

lapack_int LAPACKE_dbdsvdx_work ( int  matrix_layout,
char  uplo,
char  jobz,
char  range,
lapack_int  n,
double *  d,
double *  e,
double  vl,
double  vu,
lapack_int  il,
lapack_int  iu,
lapack_int ns,
double *  s,
double *  z,
lapack_int  ldz,
double *  work,
lapack_int iwork 
)

Definition at line 36 of file lapacke_dbdsvdx_work.c.

42 {
43  lapack_int info = 0;
44  if( matrix_layout == LAPACK_COL_MAJOR ) {
45  /* Call LAPACK function and adjust info */
46  LAPACK_dbdsvdx( &uplo, &jobz, &range, &n, d, e, &vl, &vu,
47  &il, &iu, ns, s, z, &ldz,
48  work, iwork, &info );
49  if( info < 0 ) {
50  info = info - 1;
51  }
52  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
53  lapack_int nrows_z = ( LAPACKE_lsame( jobz, 'v' ) ) ? 2*n : 0;
54  lapack_int ncols_z = ( LAPACKE_lsame( jobz, 'v' ) ) ?
55  ( LAPACKE_lsame( range, 'i' ) ? MAX(0,iu - il + 1) : n + 1 ) : 0;
56  lapack_int ldz_t = MAX(1,nrows_z);
57  double* z_t = NULL;
58  /* Check leading dimension(s) */
59  if( ldz < ncols_z ) {
60  info = -3;
61  LAPACKE_xerbla( "LAPACKE_dbdsvdx_work", info );
62  return info;
63  }
64  /* Allocate memory for temporary array(s) */
65  if( LAPACKE_lsame( jobz, 'v' ) ) {
66  z_t = (double*)
67  LAPACKE_malloc( sizeof(double) * ldz_t * MAX(ncols_z,1) );
68  if( z_t == NULL ) {
70  goto exit_level_0;
71  }
72  }
73  /* Call LAPACK function and adjust info */
74  LAPACK_dbdsvdx( &uplo, &jobz, &range, &n, d, e, &vl, &vu,
75  &il, &iu, ns, s, z_t, &ldz_t, work,
76  iwork, &info );
77  if( info < 0 ) {
78  info = info - 1;
79  }
80  /* Transpose output matrices */
81  if( LAPACKE_lsame( jobz, 'v' ) ) {
82  LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_z, ncols_z, z_t, ldz_t, z, ldz);
83  }
84  /* Release memory and exit */
85  if( LAPACKE_lsame( jobz, 'v' ) ) {
86  LAPACKE_free( z_t );
87  }
88 exit_level_0:
89  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
90  LAPACKE_xerbla( "LAPACKE_dbdsvdx_work", info );
91  }
92  } else {
93  info = -1;
94  LAPACKE_xerbla( "LAPACKE_dbdsvdx_work", info );
95  }
96  return info;
97 }
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
#define LAPACKE_free(p)
Definition: lapacke.h:113
#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_dbdsvdx(char *uplo, char *jobz, char *range, lapack_int *n, double *d, double *e, double *vl, double *vu, lapack_int *il, lapack_int *iu, lapack_int *ns, double *s, double *z, lapack_int *ldz, double *work, lapack_int *iwork, lapack_int *info)
Here is the call graph for this function:
Here is the caller graph for this function: