LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dbdsdc_work()

lapack_int LAPACKE_dbdsdc_work ( int  matrix_layout,
char  uplo,
char  compq,
lapack_int  n,
double *  d,
double *  e,
double *  u,
lapack_int  ldu,
double *  vt,
lapack_int  ldvt,
double *  q,
lapack_int iq,
double *  work,
lapack_int iwork 
)

Definition at line 35 of file lapacke_dbdsdc_work.c.

41 {
42  lapack_int info = 0;
43  if( matrix_layout == LAPACK_COL_MAJOR ) {
44  /* Call LAPACK function and adjust info */
45  LAPACK_dbdsdc( &uplo, &compq, &n, d, e, u, &ldu, vt, &ldvt, q, iq, work,
46  iwork, &info );
47  if( info < 0 ) {
48  info = info - 1;
49  }
50  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
51  lapack_int ldu_t = MAX(1,n);
52  lapack_int ldvt_t = MAX(1,n);
53  double* u_t = NULL;
54  double* vt_t = NULL;
55  /* Check leading dimension(s) */
56  if( ldu < n ) {
57  info = -8;
58  LAPACKE_xerbla( "LAPACKE_dbdsdc_work", info );
59  return info;
60  }
61  if( ldvt < n ) {
62  info = -10;
63  LAPACKE_xerbla( "LAPACKE_dbdsdc_work", info );
64  return info;
65  }
66  /* Allocate memory for temporary array(s) */
67  if( LAPACKE_lsame( compq, 'i' ) ) {
68  u_t = (double*)LAPACKE_malloc( sizeof(double) * ldu_t * MAX(1,n) );
69  if( u_t == NULL ) {
71  goto exit_level_0;
72  }
73  }
74  if( LAPACKE_lsame( compq, 'i' ) ) {
75  vt_t = (double*)
76  LAPACKE_malloc( sizeof(double) * ldvt_t * MAX(1,n) );
77  if( vt_t == NULL ) {
79  goto exit_level_1;
80  }
81  }
82  /* Call LAPACK function and adjust info */
83  LAPACK_dbdsdc( &uplo, &compq, &n, d, e, u_t, &ldu_t, vt_t, &ldvt_t, q,
84  iq, work, iwork, &info );
85  if( info < 0 ) {
86  info = info - 1;
87  }
88  /* Transpose output matrices */
89  if( LAPACKE_lsame( compq, 'i' ) ) {
90  LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, u_t, ldu_t, u, ldu );
91  }
92  if( LAPACKE_lsame( compq, 'i' ) ) {
93  LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, vt_t, ldvt_t, vt, ldvt );
94  }
95  /* Release memory and exit */
96  if( LAPACKE_lsame( compq, 'i' ) ) {
97  LAPACKE_free( vt_t );
98  }
99 exit_level_1:
100  if( LAPACKE_lsame( compq, 'i' ) ) {
101  LAPACKE_free( u_t );
102  }
103 exit_level_0:
104  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
105  LAPACKE_xerbla( "LAPACKE_dbdsdc_work", info );
106  }
107  } else {
108  info = -1;
109  LAPACKE_xerbla( "LAPACKE_dbdsdc_work", info );
110  }
111  return info;
Here is the call graph for this function:
Here is the caller graph for this function:
LAPACKE_free
#define LAPACKE_free(p)
Definition: lapacke.h:47
lapack_int
#define lapack_int
Definition: lapack.h:21
LAPACKE_xerbla
void LAPACKE_xerbla(const char *name, lapack_int info)
Definition: lapacke_xerbla.c:36
MAX
#define MAX(x, y)
Definition: lapacke_utils.h:47
LAPACK_TRANSPOSE_MEMORY_ERROR
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:57
LAPACKE_malloc
#define LAPACKE_malloc(size)
Definition: lapacke.h:44
LAPACKE_lsame
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
LAPACK_ROW_MAJOR
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:53
LAPACKE_dge_trans
void LAPACKE_dge_trans(int matrix_layout, lapack_int m, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
Definition: lapacke_dge_trans.c:39
LAPACK_COL_MAJOR
#define LAPACK_COL_MAJOR
Definition: lapacke.h:54
LAPACK_dbdsdc
void LAPACK_dbdsdc(char const *uplo, char const *compq, lapack_int const *n, double *D, double *E, double *U, lapack_int const *ldu, double *VT, lapack_int const *ldvt, double *Q, lapack_int *IQ, double *work, lapack_int *iwork, lapack_int *info)