LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dorcsd2by1()

lapack_int LAPACKE_dorcsd2by1 ( int  matrix_layout,
char  jobu1,
char  jobu2,
char  jobv1t,
lapack_int  m,
lapack_int  p,
lapack_int  q,
double *  x11,
lapack_int  ldx11,
double *  x21,
lapack_int  ldx21,
double *  theta,
double *  u1,
lapack_int  ldu1,
double *  u2,
lapack_int  ldu2,
double *  v1t,
lapack_int  ldv1t 
)

Definition at line 36 of file lapacke_dorcsd2by1.c.

41 {
42  lapack_int info = 0;
43  lapack_int lwork = -1;
44  lapack_int* iwork = NULL;
45  double* work = NULL;
46  double work_query;
47  lapack_int nrows_x11, nrows_x21;
48  if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
49  LAPACKE_xerbla( "LAPACKE_dorcsd2by1", -1 );
50  return -1;
51  }
52 #ifndef LAPACK_DISABLE_NAN_CHECK
53  if( LAPACKE_get_nancheck() ) {
54  /* Optionally check input matrices for NaNs */
55  nrows_x11 = p;
56  nrows_x21 = m-p;
57  if( LAPACKE_dge_nancheck( matrix_layout, nrows_x11, q, x11, ldx11 ) ) {
58  return -8;
59  }
60 
61  if( LAPACKE_dge_nancheck( matrix_layout, nrows_x21, q, x21, ldx21 ) ) {
62  return -9;
63  }
64  }
65 #endif
66  /* Allocate memory for working array(s) */
67  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,m-MIN(MIN(p,m-p),MIN(q,m-q))) );
68  if( iwork == NULL ) {
70  goto exit_level_0;
71  }
72  /* Query optimal working array(s) size */
73  info = LAPACKE_dorcsd2by1_work( matrix_layout, jobu1, jobu2, jobv1t, m, p, q,
74  x11, ldx11, x21, ldx21, theta, u1, ldu1, u2,
75  ldu2, v1t, ldv1t, &work_query,
76  lwork, iwork );
77  if( info != 0 ) {
78  goto exit_level_1;
79  }
80  lwork = (lapack_int)work_query;
81  /* Allocate memory for work arrays */
82  work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
83  if( work == NULL ) {
85  goto exit_level_1;
86  }
87  /* Call middle-level interface */
88  info = LAPACKE_dorcsd2by1_work( matrix_layout, jobu1, jobu2, jobv1t, m, p, q,
89  x11, ldx11, x21, ldx21, theta, u1, ldu1, u2,
90  ldu2, v1t, ldv1t, work, lwork, iwork );
91  /* Release memory and exit */
92  LAPACKE_free( work );
93 exit_level_1:
94  LAPACKE_free( iwork );
95 exit_level_0:
96  if( info == LAPACK_WORK_MEMORY_ERROR ) {
97  LAPACKE_xerbla( "LAPACKE_dorcsd2by1", info );
98  }
99  return info;
100 }
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:122
#define LAPACKE_free(p)
Definition: lapacke.h:113
#define MIN(x, y)
Definition: lapacke_utils.h:50
#define MAX(x, y)
Definition: lapacke_utils.h:47
lapack_logical LAPACKE_dge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const double *a, lapack_int lda)
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
#define LAPACK_COL_MAJOR
Definition: lapacke.h:120
void LAPACKE_xerbla(const char *name, lapack_int info)
lapack_int LAPACKE_dorcsd2by1_work(int matrix_layout, char jobu1, char jobu2, char jobv1t, lapack_int m, lapack_int p, lapack_int q, double *x11, lapack_int ldx11, double *x21, lapack_int ldx21, double *theta, double *u1, lapack_int ldu1, double *u2, lapack_int ldu2, double *v1t, lapack_int ldv1t, double *work, lapack_int lwork, lapack_int *iwork)
#define lapack_int
Definition: lapacke.h:47
int LAPACKE_get_nancheck()
Here is the call graph for this function: