LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
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  /* Optionally check input matrices for NaNs */
54  nrows_x11 = p ;
55  nrows_x21 = m-p ;
56  if( LAPACKE_dge_nancheck( matrix_layout, nrows_x11, q, x11, ldx11 ) ) {
57  return -8;
58  }
59 
60  if( LAPACKE_dge_nancheck( matrix_layout, nrows_x21, q, x21, ldx21 ) ) {
61  return -9;
62  }
63 
64 #endif
65  /* Allocate memory for working array(s) */
66  iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,m-MIN(MIN(p,m-p),MIN(q,m-q))) );
67  if( iwork == NULL ) {
69  goto exit_level_0;
70  }
71  /* Query optimal working array(s) size */
72  info = LAPACKE_dorcsd2by1_work( matrix_layout, jobu1, jobu2, jobv1t, m, p, q,
73  x11, ldx11, x21, ldx21, theta, u1, ldu1, u2,
74  ldu2, v1t, ldv1t, &work_query,
75  lwork, iwork );
76  if( info != 0 ) {
77  goto exit_level_1;
78  }
79  lwork = (lapack_int)work_query;
80  /* Allocate memory for work arrays */
81  work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
82  if( work == NULL ) {
84  goto exit_level_1;
85  }
86  /* Call middle-level interface */
87  info = LAPACKE_dorcsd2by1_work( matrix_layout, jobu1, jobu2, jobv1t, m, p, q,
88  x11, ldx11, x21, ldx21, theta, u1, ldu1, u2,
89  ldu2, v1t, ldv1t, work, lwork, iwork );
90  /* Release memory and exit */
91  LAPACKE_free( work );
92 exit_level_1:
93  LAPACKE_free( iwork );
94 exit_level_0:
95  if( info == LAPACK_WORK_MEMORY_ERROR ) {
96  LAPACKE_xerbla( "LAPACKE_dorcsd2by1", info );
97  }
98  return info;
99 }
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:122
#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_free(p)
Definition: lapacke.h:113
#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

Here is the call graph for this function: