LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_dorcsd_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,
double *  x11,
lapack_int  ldx11,
double *  x12,
lapack_int  ldx12,
double *  x21,
lapack_int  ldx21,
double *  x22,
lapack_int  ldx22,
double *  theta,
double *  u1,
lapack_int  ldu1,
double *  u2,
lapack_int  ldu2,
double *  v1t,
lapack_int  ldv1t,
double *  v2t,
lapack_int  ldv2t,
double *  work,
lapack_int  lwork,
lapack_int iwork 
)

Definition at line 36 of file lapacke_dorcsd_work.c.

47 {
48  lapack_int info = 0;
49  if( matrix_layout == LAPACK_COL_MAJOR ) {
50  /* Call LAPACK function and adjust info */
51  LAPACK_dorcsd( &jobu1, &jobu2, &jobv1t, &jobv2t, &trans, &signs, &m, &p,
52  &q, x11, &ldx11, x12, &ldx12, x21, &ldx21, x22, &ldx22,
53  theta, u1, &ldu1, u2, &ldu2, v1t, &ldv1t, v2t, &ldv2t,
54  work, &lwork, iwork, &info );
55  if( info < 0 ) {
56  info = info - 1;
57  }
58  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
59  lapack_int nrows_x11 = ( LAPACKE_lsame( trans, 'n' ) ? p : q);
60  lapack_int nrows_x12 = ( LAPACKE_lsame( trans, 'n' ) ? p : m-q);
61  lapack_int nrows_x21 = ( LAPACKE_lsame( trans, 'n' ) ? m-p : q);
62  lapack_int nrows_x22 = ( LAPACKE_lsame( trans, 'n' ) ? m-p : m-q);
63  lapack_int nrows_u1 = ( LAPACKE_lsame( jobu1, 'y' ) ? p : 1);
64  lapack_int nrows_u2 = ( LAPACKE_lsame( jobu2, 'y' ) ? m-p : 1);
65  lapack_int nrows_v1t = ( LAPACKE_lsame( jobv1t, 'y' ) ? q : 1);
66  lapack_int nrows_v2t = ( LAPACKE_lsame( jobv2t, 'y' ) ? m-q : 1);
67  lapack_int ldu1_t = MAX(1,nrows_u1);
68  lapack_int ldu2_t = MAX(1,nrows_u2);
69  lapack_int ldv1t_t = MAX(1,nrows_v1t);
70  lapack_int ldv2t_t = MAX(1,nrows_v2t);
71  lapack_int ldx11_t = MAX(1,nrows_x11);
72  lapack_int ldx12_t = MAX(1,nrows_x12);
73  lapack_int ldx21_t = MAX(1,nrows_x21);
74  lapack_int ldx22_t = MAX(1,nrows_x22);
75  double* x11_t = NULL;
76  double* x12_t = NULL;
77  double* x21_t = NULL;
78  double* x22_t = NULL;
79  double* u1_t = NULL;
80  double* u2_t = NULL;
81  double* v1t_t = NULL;
82  double* v2t_t = NULL;
83  /* Check leading dimension(s) */
84  if( ldu1 < p ) {
85  info = -21;
86  LAPACKE_xerbla( "LAPACKE_dorcsd_work", info );
87  return info;
88  }
89  if( ldu2 < m-p ) {
90  info = -23;
91  LAPACKE_xerbla( "LAPACKE_dorcsd_work", info );
92  return info;
93  }
94  if( ldv1t < q ) {
95  info = -25;
96  LAPACKE_xerbla( "LAPACKE_dorcsd_work", info );
97  return info;
98  }
99  if( ldv2t < m-q ) {
100  info = -27;
101  LAPACKE_xerbla( "LAPACKE_dorcsd_work", info );
102  return info;
103  }
104  if( ldx11 < q ) {
105  info = -12;
106  LAPACKE_xerbla( "LAPACKE_dorcsd_work", info );
107  return info;
108  }
109  if( ldx12 < m-q ) {
110  info = -14;
111  LAPACKE_xerbla( "LAPACKE_dorcsd_work", info );
112  return info;
113  }
114  if( ldx21 < q ) {
115  info = -16;
116  LAPACKE_xerbla( "LAPACKE_dorcsd_work", info );
117  return info;
118  }
119  if( ldx22 < m-q ) {
120  info = -18;
121  LAPACKE_xerbla( "LAPACKE_dorcsd_work", info );
122  return info;
123  }
124  /* Query optimal working array(s) size if requested */
125  if( lwork == -1 ) {
126  LAPACK_dorcsd( &jobu1, &jobu2, &jobv1t, &jobv2t, &trans, &signs, &m,
127  &p, &q, x11, &ldx11_t, x12, &ldx12_t, x21, &ldx21_t,
128  x22, &ldx22_t, theta, u1, &ldu1_t, u2, &ldu2_t, v1t,
129  &ldv1t_t, v2t, &ldv2t_t, work, &lwork, iwork,
130  &info );
131  return (info < 0) ? (info - 1) : info;
132  }
133  /* Allocate memory for temporary array(s) */
134  x11_t = (double*)LAPACKE_malloc( sizeof(double) * ldx11_t * MAX(1,q) );
135  if( x11_t == NULL ) {
137  goto exit_level_0;
138  }
139  x12_t = (double*)
140  LAPACKE_malloc( sizeof(double) * ldx12_t * MAX(1,m-q) );
141  if( x12_t == NULL ) {
143  goto exit_level_1;
144  }
145  x21_t = (double*)LAPACKE_malloc( sizeof(double) * ldx21_t * MAX(1,q) );
146  if( x21_t == NULL ) {
148  goto exit_level_2;
149  }
150  x22_t = (double*)
151  LAPACKE_malloc( sizeof(double) * ldx22_t * MAX(1,m-q) );
152  if( x22_t == NULL ) {
154  goto exit_level_3;
155  }
156  if( LAPACKE_lsame( jobu1, 'y' ) ) {
157  u1_t = (double*)
158  LAPACKE_malloc( sizeof(double) * ldu1_t * MAX(1,p) );
159  if( u1_t == NULL ) {
161  goto exit_level_4;
162  }
163  }
164  if( LAPACKE_lsame( jobu2, 'y' ) ) {
165  u2_t = (double*)
166  LAPACKE_malloc( sizeof(double) * ldu2_t * MAX(1,m-p) );
167  if( u2_t == NULL ) {
169  goto exit_level_5;
170  }
171  }
172  if( LAPACKE_lsame( jobv1t, 'y' ) ) {
173  v1t_t = (double*)
174  LAPACKE_malloc( sizeof(double) * ldv1t_t * MAX(1,q) );
175  if( v1t_t == NULL ) {
177  goto exit_level_6;
178  }
179  }
180  if( LAPACKE_lsame( jobv2t, 'y' ) ) {
181  v2t_t = (double*)
182  LAPACKE_malloc( sizeof(double) * ldv2t_t * MAX(1,m-q) );
183  if( v2t_t == NULL ) {
185  goto exit_level_7;
186  }
187  }
188  /* Transpose input matrices */
189  LAPACKE_dge_trans( matrix_layout, nrows_x11, q, x11, ldx11, x11_t,
190  ldx11_t );
191  LAPACKE_dge_trans( matrix_layout, nrows_x12, m-q, x12, ldx12, x12_t,
192  ldx12_t );
193  LAPACKE_dge_trans( matrix_layout, nrows_x21, q, x21, ldx21, x21_t,
194  ldx21_t );
195  LAPACKE_dge_trans( matrix_layout, nrows_x22, m-q, x22, ldx22, x22_t,
196  ldx22_t );
197  /* Call LAPACK function and adjust info */
198  LAPACK_dorcsd( &jobu1, &jobu2, &jobv1t, &jobv2t, &trans, &signs, &m, &p,
199  &q, x11_t, &ldx11_t, x12_t, &ldx12_t, x21_t, &ldx21_t,
200  x22_t, &ldx22_t, theta, u1_t, &ldu1_t, u2_t, &ldu2_t,
201  v1t_t, &ldv1t_t, v2t_t, &ldv2t_t, work, &lwork, iwork,
202  &info );
203  if( info < 0 ) {
204  info = info - 1;
205  }
206  /* Transpose output matrices */
207  LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_x11, q, x11_t, ldx11_t, x11,
208  ldx11 );
209  LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_x12, m-q, x12_t, ldx12_t,
210  x12, ldx12 );
211  LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_x21, q, x21_t, ldx21_t, x21,
212  ldx21 );
213  LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_x22, m-q, x22_t, ldx22_t,
214  x22, ldx22 );
215  if( LAPACKE_lsame( jobu1, 'y' ) ) {
216  LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_u1, p, u1_t, ldu1_t, u1,
217  ldu1 );
218  }
219  if( LAPACKE_lsame( jobu2, 'y' ) ) {
220  LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_u2, m-p, u2_t, ldu2_t,
221  u2, ldu2 );
222  }
223  if( LAPACKE_lsame( jobv1t, 'y' ) ) {
224  LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_v1t, q, v1t_t, ldv1t_t,
225  v1t, ldv1t );
226  }
227  if( LAPACKE_lsame( jobv2t, 'y' ) ) {
228  LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_v2t, m-q, v2t_t, ldv2t_t,
229  v2t, ldv2t );
230  }
231  /* Release memory and exit */
232  if( LAPACKE_lsame( jobv2t, 'y' ) ) {
233  LAPACKE_free( v2t_t );
234  }
235 exit_level_7:
236  if( LAPACKE_lsame( jobv1t, 'y' ) ) {
237  LAPACKE_free( v1t_t );
238  }
239 exit_level_6:
240  if( LAPACKE_lsame( jobu2, 'y' ) ) {
241  LAPACKE_free( u2_t );
242  }
243 exit_level_5:
244  if( LAPACKE_lsame( jobu1, 'y' ) ) {
245  LAPACKE_free( u1_t );
246  }
247 exit_level_4:
248  LAPACKE_free( x22_t );
249 exit_level_3:
250  LAPACKE_free( x21_t );
251 exit_level_2:
252  LAPACKE_free( x12_t );
253 exit_level_1:
254  LAPACKE_free( x11_t );
255 exit_level_0:
256  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
257  LAPACKE_xerbla( "LAPACKE_dorcsd_work", info );
258  }
259  } else {
260  info = -1;
261  LAPACKE_xerbla( "LAPACKE_dorcsd_work", info );
262  }
263  return info;
264 }
void LAPACKE_dge_trans(int matrix_layout, lapack_int m, lapack_int n, const double *in, lapack_int ldin, double *out, lapack_int ldout)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
void LAPACK_dorcsd(char *jobu1, char *jobu2, char *jobv1t, char *jobv2t, char *trans, char *signs, lapack_int *m, lapack_int *p, lapack_int *q, double *x11, lapack_int *ldx11, double *x12, lapack_int *ldx12, double *x21, lapack_int *ldx21, double *x22, lapack_int *ldx22, double *theta, double *u1, lapack_int *ldu1, double *u2, lapack_int *ldu2, double *v1t, lapack_int *ldv1t, double *v2t, lapack_int *ldv2t, double *work, lapack_int *lwork, lapack_int *iwork, lapack_int *info)
#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: