LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_sbdsdc_work ( int  matrix_layout,
char  uplo,
char  compq,
lapack_int  n,
float *  d,
float *  e,
float *  u,
lapack_int  ldu,
float *  vt,
lapack_int  ldvt,
float *  q,
lapack_int iq,
float *  work,
lapack_int iwork 
)

Definition at line 36 of file lapacke_sbdsdc_work.c.

41 {
42  lapack_int info = 0;
43  if( matrix_layout == LAPACK_COL_MAJOR ) {
44  /* Call LAPACK function and adjust info */
45  LAPACK_sbdsdc( &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  float* u_t = NULL;
54  float* vt_t = NULL;
55  /* Check leading dimension(s) */
56  if( ldu < n ) {
57  info = -8;
58  LAPACKE_xerbla( "LAPACKE_sbdsdc_work", info );
59  return info;
60  }
61  if( ldvt < n ) {
62  info = -10;
63  LAPACKE_xerbla( "LAPACKE_sbdsdc_work", info );
64  return info;
65  }
66  /* Allocate memory for temporary array(s) */
67  if( LAPACKE_lsame( compq, 'i' ) ) {
68  u_t = (float*)LAPACKE_malloc( sizeof(float) * 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 = (float*)LAPACKE_malloc( sizeof(float) * 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_sbdsdc( &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_sge_trans( LAPACK_COL_MAJOR, n, n, u_t, ldu_t, u, ldu );
90  }
91  if( LAPACKE_lsame( compq, 'i' ) ) {
92  LAPACKE_sge_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_sbdsdc_work", info );
105  }
106  } else {
107  info = -1;
108  LAPACKE_xerbla( "LAPACKE_sbdsdc_work", info );
109  }
110  return info;
111 }
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
void LAPACK_sbdsdc(char *uplo, char *compq, lapack_int *n, float *d, float *e, float *u, lapack_int *ldu, float *vt, lapack_int *ldvt, float *q, lapack_int *iq, float *work, lapack_int *iwork, lapack_int *info)
void LAPACKE_sge_trans(int matrix_layout, lapack_int m, lapack_int n, const float *in, lapack_int ldin, float *out, lapack_int ldout)
#define MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACKE_free(p)
Definition: lapacke.h:113
#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

Here is the call graph for this function:

Here is the caller graph for this function: