LAPACK  3.9.1
LAPACK: Linear Algebra PACKage

◆ LAPACKE_sorcsd()

lapack_int LAPACKE_sorcsd ( int  matrix_layout,
char  jobu1,
char  jobu2,
char  jobv1t,
char  jobv2t,
char  trans,
char  signs,
lapack_int  m,
lapack_int  p,
lapack_int  q,
float *  x11,
lapack_int  ldx11,
float *  x12,
lapack_int  ldx12,
float *  x21,
lapack_int  ldx21,
float *  x22,
lapack_int  ldx22,
float *  theta,
float *  u1,
lapack_int  ldu1,
float *  u2,
lapack_int  ldu2,
float *  v1t,
lapack_int  ldv1t,
float *  v2t,
lapack_int  ldv2t 
)

Definition at line 35 of file lapacke_sorcsd.c.

44 {
45  lapack_int info = 0;
46  lapack_int lwork = -1;
47  lapack_int* iwork = NULL;
48  float* work = NULL;
49  float work_query;
50  int lapack_layout;
51  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
52  LAPACKE_xerbla( "LAPACKE_sorcsd", -1 );
53  return -1;
54  }
55  if( LAPACKE_lsame( trans, 'n' ) && matrix_layout == LAPACK_COL_MAJOR ) {
56  lapack_layout = LAPACK_COL_MAJOR;
57  } else {
58  lapack_layout = LAPACK_ROW_MAJOR;
59  }
60 #ifndef LAPACK_DISABLE_NAN_CHECK
61  if( LAPACKE_get_nancheck() ) {
62  /* Optionally check input matrices for NaNs */
63  if( LAPACKE_sge_nancheck( lapack_layout, p, q, x11, ldx11 ) ) {
64  return -11;
65  }
66  if( LAPACKE_sge_nancheck( lapack_layout, p, m-q, x12, ldx12 ) ) {
67  return -13;
68  }
69  if( LAPACKE_sge_nancheck( lapack_layout, m-p, q, x21, ldx21 ) ) {
70  return -15;
71  }
72  if( LAPACKE_sge_nancheck( lapack_layout, m-p, m-q, x22, ldx22 ) ) {
73  return -17;
74  }
75  }
76 #endif
77  /* Allocate memory for working array(s) */
78  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,m-MIN(MIN(p,m-p),MIN(q,m-q))) );
79  if( iwork == NULL ) {
81  goto exit_level_0;
82  }
83  /* Query optimal working array(s) size */
84  info = LAPACKE_sorcsd_work( matrix_layout, jobu1, jobu2, jobv1t, jobv2t,
85  trans, signs, m, p, q, x11, ldx11, x12, ldx12,
86  x21, ldx21, x22, ldx22, theta, u1, ldu1, u2,
87  ldu2, v1t, ldv1t, v2t, ldv2t, &work_query,
88  lwork, iwork );
89  if( info != 0 ) {
90  goto exit_level_1;
91  }
92  lwork = (lapack_int)work_query;
93  /* Allocate memory for work arrays */
94  work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
95  if( work == NULL ) {
97  goto exit_level_1;
98  }
99  /* Call middle-level interface */
100  info = LAPACKE_sorcsd_work( matrix_layout, jobu1, jobu2, jobv1t, jobv2t,
101  trans, signs, m, p, q, x11, ldx11, x12, ldx12,
102  x21, ldx21, x22, ldx22, theta, u1, ldu1, u2,
103  ldu2, v1t, ldv1t, v2t, ldv2t, work, lwork,
104  iwork );
105  /* Release memory and exit */
106  LAPACKE_free( work );
107 exit_level_1:
108  LAPACKE_free( iwork );
109 exit_level_0:
110  if( info == LAPACK_WORK_MEMORY_ERROR ) {
111  LAPACKE_xerbla( "LAPACKE_sorcsd", info );
112  }
113  return info;
114 }
#define lapack_int
Definition: lapack.h:83
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:55
#define LAPACK_COL_MAJOR
Definition: lapacke.h:53
lapack_int LAPACKE_sorcsd_work(int matrix_layout, char jobu1, char jobu2, char jobv1t, char jobv2t, char trans, char signs, lapack_int m, lapack_int p, lapack_int q, float *x11, lapack_int ldx11, float *x12, lapack_int ldx12, float *x21, lapack_int ldx21, float *x22, lapack_int ldx22, float *theta, float *u1, lapack_int ldu1, float *u2, lapack_int ldu2, float *v1t, lapack_int ldv1t, float *v2t, lapack_int ldv2t, float *work, lapack_int lwork, lapack_int *iwork)
#define LAPACKE_free(p)
Definition: lapacke.h:46
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:52
int LAPACKE_get_nancheck(void)
#define LAPACKE_malloc(size)
Definition: lapacke.h:43
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
void LAPACKE_xerbla(const char *name, lapack_int info)
lapack_logical LAPACKE_sge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const float *a, lapack_int lda)
#define MIN(x, y)
Definition: lapacke_utils.h:49
#define MAX(x, y)
Definition: lapacke_utils.h:46
Here is the call graph for this function: