LAPACK  3.10.1
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.

40 {
41  lapack_int info = 0;
42  if( matrix_layout == LAPACK_COL_MAJOR ) {
43  /* Call LAPACK function and adjust info */
44  LAPACK_dbdsdc( &uplo, &compq, &n, d, e, u, &ldu, vt, &ldvt, q, iq, work,
45  iwork, &info );
46  if( info < 0 ) {
47  info = info - 1;
48  }
49  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
50  lapack_int ldu_t = MAX(1,n);
51  lapack_int ldvt_t = MAX(1,n);
52  double* u_t = NULL;
53  double* vt_t = NULL;
54  /* Check leading dimension(s) */
55  if( ldu < n ) {
56  info = -8;
57  LAPACKE_xerbla( "LAPACKE_dbdsdc_work", info );
58  return info;
59  }
60  if( ldvt < n ) {
61  info = -10;
62  LAPACKE_xerbla( "LAPACKE_dbdsdc_work", info );
63  return info;
64  }
65  /* Allocate memory for temporary array(s) */
66  if( LAPACKE_lsame( compq, 'i' ) ) {
67  u_t = (double*)LAPACKE_malloc( sizeof(double) * ldu_t * MAX(1,n) );
68  if( u_t == NULL ) {
70  goto exit_level_0;
71  }
72  }
73  if( LAPACKE_lsame( compq, 'i' ) ) {
74  vt_t = (double*)
75  LAPACKE_malloc( sizeof(double) * ldvt_t * MAX(1,n) );
76  if( vt_t == NULL ) {
78  goto exit_level_1;
79  }
80  }
81  /* Call LAPACK function and adjust info */
82  LAPACK_dbdsdc( &uplo, &compq, &n, d, e, u_t, &ldu_t, vt_t, &ldvt_t, q,
83  iq, work, iwork, &info );
84  if( info < 0 ) {
85  info = info - 1;
86  }
87  /* Transpose output matrices */
88  if( LAPACKE_lsame( compq, 'i' ) ) {
89  LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, u_t, ldu_t, u, ldu );
90  }
91  if( LAPACKE_lsame( compq, 'i' ) ) {
92  LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, vt_t, ldvt_t, vt, ldvt );
93  }
94  /* Release memory and exit */
95  if( LAPACKE_lsame( compq, 'i' ) ) {
96  LAPACKE_free( vt_t );
97  }
98 exit_level_1:
99  if( LAPACKE_lsame( compq, 'i' ) ) {
100  LAPACKE_free( u_t );
101  }
102 exit_level_0:
103  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
104  LAPACKE_xerbla( "LAPACKE_dbdsdc_work", info );
105  }
106  } else {
107  info = -1;
108  LAPACKE_xerbla( "LAPACKE_dbdsdc_work", info );
109  }
110  return info;
111 }
#define LAPACK_dbdsdc(...)
Definition: lapack.h:271
#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: