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

Definition at line 36 of file lapacke_zuncsd_work.c.

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

Here is the call graph for this function:

Here is the caller graph for this function: