14 typedef long long BLASLONG;
15 typedef unsigned long long BLASULONG;
17 typedef long BLASLONG;
18 typedef unsigned long BLASULONG;
22 typedef BLASLONG blasint;
24 #define blasabs(x) llabs(x)
26 #define blasabs(x) labs(x)
30 #define blasabs(x) abs(x)
33 typedef blasint integer;
35 typedef unsigned int uinteger;
36 typedef char *address;
37 typedef short int shortint;
39 typedef double doublereal;
40 typedef struct { real r, i; } complex;
41 typedef struct { doublereal r, i; } doublecomplex;
43 static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;}
44 static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
45 static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;}
46 static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
48 static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
49 static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
50 static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
51 static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
53 #define pCf(z) (*_pCf(z))
54 #define pCd(z) (*_pCd(z))
56 typedef short int shortlogical;
57 typedef char logical1;
58 typedef char integer1;
63 /* Extern is for use with -E */
74 /*external read, write*/
83 /*internal read, write*/
113 /*rewind, backspace, endfile*/
125 ftnint *inex; /*parameters in standard's order*/
151 union Multitype { /* for multiple entry points */
162 typedef union Multitype Multitype;
164 struct Vardesc { /* for Namelist */
170 typedef struct Vardesc Vardesc;
177 typedef struct Namelist Namelist;
179 #define abs(x) ((x) >= 0 ? (x) : -(x))
180 #define dabs(x) (fabs(x))
181 #define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
182 #define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
183 #define dmin(a,b) (f2cmin(a,b))
184 #define dmax(a,b) (f2cmax(a,b))
185 #define bit_test(a,b) ((a) >> (b) & 1)
186 #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
187 #define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
189 #define abort_() { sig_die("Fortran abort routine called", 1); }
190 #define c_abs(z) (cabsf(Cf(z)))
191 #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
193 #define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);}
194 #define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/df(b)._Val[1]);}
196 #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
197 #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
199 #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
200 #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
201 #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
202 //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
203 #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
204 #define d_abs(x) (fabs(*(x)))
205 #define d_acos(x) (acos(*(x)))
206 #define d_asin(x) (asin(*(x)))
207 #define d_atan(x) (atan(*(x)))
208 #define d_atn2(x, y) (atan2(*(x),*(y)))
209 #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
210 #define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
211 #define d_cos(x) (cos(*(x)))
212 #define d_cosh(x) (cosh(*(x)))
213 #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
214 #define d_exp(x) (exp(*(x)))
215 #define d_imag(z) (cimag(Cd(z)))
216 #define r_imag(z) (cimagf(Cf(z)))
217 #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
218 #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
219 #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
220 #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
221 #define d_log(x) (log(*(x)))
222 #define d_mod(x, y) (fmod(*(x), *(y)))
223 #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
224 #define d_nint(x) u_nint(*(x))
225 #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
226 #define d_sign(a,b) u_sign(*(a),*(b))
227 #define r_sign(a,b) u_sign(*(a),*(b))
228 #define d_sin(x) (sin(*(x)))
229 #define d_sinh(x) (sinh(*(x)))
230 #define d_sqrt(x) (sqrt(*(x)))
231 #define d_tan(x) (tan(*(x)))
232 #define d_tanh(x) (tanh(*(x)))
233 #define i_abs(x) abs(*(x))
234 #define i_dnnt(x) ((integer)u_nint(*(x)))
235 #define i_len(s, n) (n)
236 #define i_nint(x) ((integer)u_nint(*(x)))
237 #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
238 #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
239 #define pow_si(B,E) spow_ui(*(B),*(E))
240 #define pow_ri(B,E) spow_ui(*(B),*(E))
241 #define pow_di(B,E) dpow_ui(*(B),*(E))
242 #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
243 #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
244 #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
245 #define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; }
246 #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
247 #define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; }
248 #define sig_die(s, kill) { exit(1); }
249 #define s_stop(s, n) {exit(0);}
250 static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
251 #define z_abs(z) (cabs(Cd(z)))
252 #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
253 #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
254 #define myexit_() break;
255 #define mycycle() continue;
256 #define myceiling(w) {ceil(w)}
257 #define myhuge(w) {HUGE_VAL}
258 //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
259 #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
261 /* procedure parameter types for -A and -C++ */
263 #define F2C_proc_par_types 1
265 typedef logical (*L_fp)(...);
267 typedef logical (*L_fp)();
270 static float spow_ui(float x, integer n) {
271 float pow=1.0; unsigned long int u;
273 if(n < 0) n = -n, x = 1/x;
282 static double dpow_ui(double x, integer n) {
283 double pow=1.0; unsigned long int u;
285 if(n < 0) n = -n, x = 1/x;
295 static _Fcomplex cpow_ui(complex x, integer n) {
296 complex pow={1.0,0.0}; unsigned long int u;
298 if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i;
300 if(u & 01) pow.r *= x.r, pow.i *= x.i;
301 if(u >>= 1) x.r *= x.r, x.i *= x.i;
305 _Fcomplex p={pow.r, pow.i};
309 static _Complex float cpow_ui(_Complex float x, integer n) {
310 _Complex float pow=1.0; unsigned long int u;
312 if(n < 0) n = -n, x = 1/x;
323 static _Dcomplex zpow_ui(_Dcomplex x, integer n) {
324 _Dcomplex pow={1.0,0.0}; unsigned long int u;
326 if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1];
328 if(u & 01) pow._Val[0] *= x._Val[0], pow._Val[1] *= x._Val[1];
329 if(u >>= 1) x._Val[0] *= x._Val[0], x._Val[1] *= x._Val[1];
333 _Dcomplex p = {pow._Val[0], pow._Val[1]};
337 static _Complex double zpow_ui(_Complex double x, integer n) {
338 _Complex double pow=1.0; unsigned long int u;
340 if(n < 0) n = -n, x = 1/x;
350 static integer pow_ii(integer x, integer n) {
351 integer pow; unsigned long int u;
353 if (n == 0 || x == 1) pow = 1;
354 else if (x != -1) pow = x == 0 ? 1/x : 0;
357 if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
367 static integer dmaxloc_(double *w, integer s, integer e, integer *n)
369 double m; integer i, mi;
370 for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
371 if (w[i-1]>m) mi=i ,m=w[i-1];
374 static integer smaxloc_(float *w, integer s, integer e, integer *n)
376 float m; integer i, mi;
377 for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
378 if (w[i-1]>m) mi=i ,m=w[i-1];
381 static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
382 integer n = *n_, incx = *incx_, incy = *incy_, i;
384 _Fcomplex zdotc = {0.0, 0.0};
385 if (incx == 1 && incy == 1) {
386 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
387 zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0];
388 zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1];
391 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
392 zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0];
393 zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1];
399 _Complex float zdotc = 0.0;
400 if (incx == 1 && incy == 1) {
401 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
402 zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
405 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
406 zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
412 static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
413 integer n = *n_, incx = *incx_, incy = *incy_, i;
415 _Dcomplex zdotc = {0.0, 0.0};
416 if (incx == 1 && incy == 1) {
417 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
418 zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0];
419 zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1];
422 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
423 zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0];
424 zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1];
430 _Complex double zdotc = 0.0;
431 if (incx == 1 && incy == 1) {
432 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
433 zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
436 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
437 zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
443 static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
444 integer n = *n_, incx = *incx_, incy = *incy_, i;
446 _Fcomplex zdotc = {0.0, 0.0};
447 if (incx == 1 && incy == 1) {
448 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
449 zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0];
450 zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1];
453 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
454 zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0];
455 zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1];
461 _Complex float zdotc = 0.0;
462 if (incx == 1 && incy == 1) {
463 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
464 zdotc += Cf(&x[i]) * Cf(&y[i]);
467 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
468 zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
474 static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
475 integer n = *n_, incx = *incx_, incy = *incy_, i;
477 _Dcomplex zdotc = {0.0, 0.0};
478 if (incx == 1 && incy == 1) {
479 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
480 zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0];
481 zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1];
484 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
485 zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0];
486 zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1];
492 _Complex double zdotc = 0.0;
493 if (incx == 1 && incy == 1) {
494 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
495 zdotc += Cd(&x[i]) * Cd(&y[i]);
498 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
499 zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
505 /* -- translated by f2c (version 20000121).
506 You must link the resulting object file with the libraries:
507 -lf2c -lm (in that order)
513 /* Table of constant values */
515 static integer c__1 = 1;
517 /* > \brief \b CUNBDB */
519 /* =========== DOCUMENTATION =========== */
521 /* Online html documentation available at */
522 /* http://www.netlib.org/lapack/explore-html/ */
525 /* > Download CUNBDB + dependencies */
526 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cunbdb.
529 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cunbdb.
532 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cunbdb.
540 /* SUBROUTINE CUNBDB( TRANS, SIGNS, M, P, Q, X11, LDX11, X12, LDX12, */
541 /* X21, LDX21, X22, LDX22, THETA, PHI, TAUP1, */
542 /* TAUP2, TAUQ1, TAUQ2, WORK, LWORK, INFO ) */
544 /* CHARACTER SIGNS, TRANS */
545 /* INTEGER INFO, LDX11, LDX12, LDX21, LDX22, LWORK, M, P, */
547 /* REAL PHI( * ), THETA( * ) */
548 /* COMPLEX TAUP1( * ), TAUP2( * ), TAUQ1( * ), TAUQ2( * ), */
549 /* $ WORK( * ), X11( LDX11, * ), X12( LDX12, * ), */
550 /* $ X21( LDX21, * ), X22( LDX22, * ) */
553 /* > \par Purpose: */
558 /* > CUNBDB simultaneously bidiagonalizes the blocks of an M-by-M */
559 /* > partitioned unitary matrix X: */
561 /* > [ B11 | B12 0 0 ] */
562 /* > [ X11 | X12 ] [ P1 | ] [ 0 | 0 -I 0 ] [ Q1 | ]**H */
563 /* > X = [-----------] = [---------] [----------------] [---------] . */
564 /* > [ X21 | X22 ] [ | P2 ] [ B21 | B22 0 0 ] [ | Q2 ] */
565 /* > [ 0 | 0 0 I ] */
567 /* > X11 is P-by-Q. Q must be no larger than P, M-P, or M-Q. (If this is */
568 /* > not the case, then X must be transposed and/or permuted. This can be */
569 /* > done in constant time using the TRANS and SIGNS options. See CUNCSD */
570 /* > for details.) */
572 /* > The unitary matrices P1, P2, Q1, and Q2 are P-by-P, (M-P)-by- */
573 /* > (M-P), Q-by-Q, and (M-Q)-by-(M-Q), respectively. They are */
574 /* > represented implicitly by Householder vectors. */
576 /* > B11, B12, B21, and B22 are Q-by-Q bidiagonal matrices represented */
577 /* > implicitly by angles THETA, PHI. */
583 /* > \param[in] TRANS */
585 /* > TRANS is CHARACTER */
586 /* > = 'T': X, U1, U2, V1T, and V2T are stored in row-major */
588 /* > otherwise: X, U1, U2, V1T, and V2T are stored in column- */
592 /* > \param[in] SIGNS */
594 /* > SIGNS is CHARACTER */
595 /* > = 'O': The lower-left block is made nonpositive (the */
596 /* > "other" convention); */
597 /* > otherwise: The upper-right block is made nonpositive (the */
598 /* > "default" convention). */
604 /* > The number of rows and columns in X. */
610 /* > The number of rows in X11 and X12. 0 <= P <= M. */
616 /* > The number of columns in X11 and X21. 0 <= Q <= */
617 /* > MIN(P,M-P,M-Q). */
620 /* > \param[in,out] X11 */
622 /* > X11 is COMPLEX array, dimension (LDX11,Q) */
623 /* > On entry, the top-left block of the unitary matrix to be */
624 /* > reduced. On exit, the form depends on TRANS: */
625 /* > If TRANS = 'N', then */
626 /* > the columns of tril(X11) specify reflectors for P1, */
627 /* > the rows of triu(X11,1) specify reflectors for Q1; */
628 /* > else TRANS = 'T', and */
629 /* > the rows of triu(X11) specify reflectors for P1, */
630 /* > the columns of tril(X11,-1) specify reflectors for Q1. */
633 /* > \param[in] LDX11 */
635 /* > LDX11 is INTEGER */
636 /* > The leading dimension of X11. If TRANS = 'N', then LDX11 >= */
637 /* > P; else LDX11 >= Q. */
640 /* > \param[in,out] X12 */
642 /* > X12 is COMPLEX array, dimension (LDX12,M-Q) */
643 /* > On entry, the top-right block of the unitary matrix to */
644 /* > be reduced. On exit, the form depends on TRANS: */
645 /* > If TRANS = 'N', then */
646 /* > the rows of triu(X12) specify the first P reflectors for */
648 /* > else TRANS = 'T', and */
649 /* > the columns of tril(X12) specify the first P reflectors */
653 /* > \param[in] LDX12 */
655 /* > LDX12 is INTEGER */
656 /* > The leading dimension of X12. If TRANS = 'N', then LDX12 >= */
657 /* > P; else LDX11 >= M-Q. */
660 /* > \param[in,out] X21 */
662 /* > X21 is COMPLEX array, dimension (LDX21,Q) */
663 /* > On entry, the bottom-left block of the unitary matrix to */
664 /* > be reduced. On exit, the form depends on TRANS: */
665 /* > If TRANS = 'N', then */
666 /* > the columns of tril(X21) specify reflectors for P2; */
667 /* > else TRANS = 'T', and */
668 /* > the rows of triu(X21) specify reflectors for P2. */
671 /* > \param[in] LDX21 */
673 /* > LDX21 is INTEGER */
674 /* > The leading dimension of X21. If TRANS = 'N', then LDX21 >= */
675 /* > M-P; else LDX21 >= Q. */
678 /* > \param[in,out] X22 */
680 /* > X22 is COMPLEX array, dimension (LDX22,M-Q) */
681 /* > On entry, the bottom-right block of the unitary matrix to */
682 /* > be reduced. On exit, the form depends on TRANS: */
683 /* > If TRANS = 'N', then */
684 /* > the rows of triu(X22(Q+1:M-P,P+1:M-Q)) specify the last */
685 /* > M-P-Q reflectors for Q2, */
686 /* > else TRANS = 'T', and */
687 /* > the columns of tril(X22(P+1:M-Q,Q+1:M-P)) specify the last */
688 /* > M-P-Q reflectors for P2. */
691 /* > \param[in] LDX22 */
693 /* > LDX22 is INTEGER */
694 /* > The leading dimension of X22. If TRANS = 'N', then LDX22 >= */
695 /* > M-P; else LDX22 >= M-Q. */
698 /* > \param[out] THETA */
700 /* > THETA is REAL array, dimension (Q) */
701 /* > The entries of the bidiagonal blocks B11, B12, B21, B22 can */
702 /* > be computed from the angles THETA and PHI. See Further */
706 /* > \param[out] PHI */
708 /* > PHI is REAL array, dimension (Q-1) */
709 /* > The entries of the bidiagonal blocks B11, B12, B21, B22 can */
710 /* > be computed from the angles THETA and PHI. See Further */
714 /* > \param[out] TAUP1 */
716 /* > TAUP1 is COMPLEX array, dimension (P) */
717 /* > The scalar factors of the elementary reflectors that define */
721 /* > \param[out] TAUP2 */
723 /* > TAUP2 is COMPLEX array, dimension (M-P) */
724 /* > The scalar factors of the elementary reflectors that define */
728 /* > \param[out] TAUQ1 */
730 /* > TAUQ1 is COMPLEX array, dimension (Q) */
731 /* > The scalar factors of the elementary reflectors that define */
735 /* > \param[out] TAUQ2 */
737 /* > TAUQ2 is COMPLEX array, dimension (M-Q) */
738 /* > The scalar factors of the elementary reflectors that define */
742 /* > \param[out] WORK */
744 /* > WORK is COMPLEX array, dimension (LWORK) */
747 /* > \param[in] LWORK */
749 /* > LWORK is INTEGER */
750 /* > The dimension of the array WORK. LWORK >= M-Q. */
752 /* > If LWORK = -1, then a workspace query is assumed; the routine */
753 /* > only calculates the optimal size of the WORK array, returns */
754 /* > this value as the first entry of the WORK array, and no error */
755 /* > message related to LWORK is issued by XERBLA. */
758 /* > \param[out] INFO */
760 /* > INFO is INTEGER */
761 /* > = 0: successful exit. */
762 /* > < 0: if INFO = -i, the i-th argument had an illegal value. */
768 /* > \author Univ. of Tennessee */
769 /* > \author Univ. of California Berkeley */
770 /* > \author Univ. of Colorado Denver */
771 /* > \author NAG Ltd. */
773 /* > \date December 2016 */
775 /* > \ingroup complexOTHERcomputational */
777 /* > \par Further Details: */
778 /* ===================== */
782 /* > The bidiagonal blocks B11, B12, B21, and B22 are represented */
783 /* > implicitly by angles THETA(1), ..., THETA(Q) and PHI(1), ..., */
784 /* > PHI(Q-1). B11 and B21 are upper bidiagonal, while B21 and B22 are */
785 /* > lower bidiagonal. Every entry in each bidiagonal band is a product */
786 /* > of a sine or cosine of a THETA with a sine or cosine of a PHI. See */
787 /* > [1] or CUNCSD for details. */
789 /* > P1, P2, Q1, and Q2 are represented as products of elementary */
790 /* > reflectors. See CUNCSD for details on generating P1, P2, Q1, and Q2 */
791 /* > using CUNGQR and CUNGLQ. */
794 /* > \par References: */
795 /* ================ */
797 /* > [1] Brian D. Sutton. Computing the complete CS decomposition. Numer. */
798 /* > Algorithms, 50(1):33-65, 2009. */
800 /* ===================================================================== */
801 /* Subroutine */ int cunbdb_(char *trans, char *signs, integer *m, integer *p,
802 integer *q, complex *x11, integer *ldx11, complex *x12, integer *
803 ldx12, complex *x21, integer *ldx21, complex *x22, integer *ldx22,
804 real *theta, real *phi, complex *taup1, complex *taup2, complex *
805 tauq1, complex *tauq2, complex *work, integer *lwork, integer *info)
807 /* System generated locals */
808 integer x11_dim1, x11_offset, x12_dim1, x12_offset, x21_dim1, x21_offset,
809 x22_dim1, x22_offset, i__1, i__2, i__3;
813 /* Local variables */
815 integer lworkmin, lworkopt, i__;
816 extern /* Subroutine */ int cscal_(integer *, complex *, complex *,
817 integer *), clarf_(char *, integer *, integer *, complex *,
818 integer *, complex *, complex *, integer *, complex *);
819 extern logical lsame_(char *, char *);
820 extern /* Subroutine */ int caxpy_(integer *, complex *, complex *,
821 integer *, complex *, integer *);
823 extern real scnrm2_(integer *, complex *, integer *);
824 extern /* Subroutine */ int clacgv_(integer *, complex *, integer *),
825 xerbla_(char *, integer *, ftnlen);
827 extern /* Subroutine */ int clarfgp_(integer *, complex *, complex *,
828 integer *, complex *);
831 /* -- LAPACK computational routine (version 3.7.0) -- */
832 /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
833 /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
837 /* ==================================================================== */
841 /* Test input arguments */
843 /* Parameter adjustments */
845 x11_offset = 1 + x11_dim1 * 1;
848 x12_offset = 1 + x12_dim1 * 1;
851 x21_offset = 1 + x21_dim1 * 1;
854 x22_offset = 1 + x22_dim1 * 1;
866 colmajor = ! lsame_(trans, "T");
867 if (! lsame_(signs, "O")) {
878 lquery = *lwork == -1;
882 } else if (*p < 0 || *p > *m) {
884 } else if (*q < 0 || *q > *p || *q > *m - *p || *q > *m - *q) {
886 } else if (colmajor && *ldx11 < f2cmax(1,*p)) {
888 } else if (! colmajor && *ldx11 < f2cmax(1,*q)) {
890 } else if (colmajor && *ldx12 < f2cmax(1,*p)) {
892 } else /* if(complicated condition) */ {
894 i__1 = 1, i__2 = *m - *q;
895 if (! colmajor && *ldx12 < f2cmax(i__1,i__2)) {
897 } else /* if(complicated condition) */ {
899 i__1 = 1, i__2 = *m - *p;
900 if (colmajor && *ldx21 < f2cmax(i__1,i__2)) {
902 } else if (! colmajor && *ldx21 < f2cmax(1,*q)) {
904 } else /* if(complicated condition) */ {
906 i__1 = 1, i__2 = *m - *p;
907 if (colmajor && *ldx22 < f2cmax(i__1,i__2)) {
909 } else /* if(complicated condition) */ {
911 i__1 = 1, i__2 = *m - *q;
912 if (! colmajor && *ldx22 < f2cmax(i__1,i__2)) {
920 /* Compute workspace */
925 work[1].r = (real) lworkopt, work[1].i = 0.f;
926 if (*lwork < lworkmin && ! lquery) {
932 xerbla_("xORBDB", &i__1, (ftnlen)6);
938 /* Handle column-major and row-major separately */
942 /* Reduce columns 1, ..., Q of X11, X12, X21, and X22 */
945 for (i__ = 1; i__ <= i__1; ++i__) {
949 q__1.r = z1, q__1.i = 0.f;
950 cscal_(&i__2, &q__1, &x11[i__ + i__ * x11_dim1], &c__1);
953 r__1 = z1 * cos(phi[i__ - 1]);
954 q__1.r = r__1, q__1.i = 0.f;
955 cscal_(&i__2, &q__1, &x11[i__ + i__ * x11_dim1], &c__1);
957 r__1 = -z1 * z3 * z4 * sin(phi[i__ - 1]);
958 q__1.r = r__1, q__1.i = 0.f;
959 caxpy_(&i__2, &q__1, &x12[i__ + (i__ - 1) * x12_dim1], &c__1,
960 &x11[i__ + i__ * x11_dim1], &c__1);
963 i__2 = *m - *p - i__ + 1;
964 q__1.r = z2, q__1.i = 0.f;
965 cscal_(&i__2, &q__1, &x21[i__ + i__ * x21_dim1], &c__1);
967 i__2 = *m - *p - i__ + 1;
968 r__1 = z2 * cos(phi[i__ - 1]);
969 q__1.r = r__1, q__1.i = 0.f;
970 cscal_(&i__2, &q__1, &x21[i__ + i__ * x21_dim1], &c__1);
971 i__2 = *m - *p - i__ + 1;
972 r__1 = -z2 * z3 * z4 * sin(phi[i__ - 1]);
973 q__1.r = r__1, q__1.i = 0.f;
974 caxpy_(&i__2, &q__1, &x22[i__ + (i__ - 1) * x22_dim1], &c__1,
975 &x21[i__ + i__ * x21_dim1], &c__1);
978 i__2 = *m - *p - i__ + 1;
980 theta[i__] = atan2(scnrm2_(&i__2, &x21[i__ + i__ * x21_dim1], &
981 c__1), scnrm2_(&i__3, &x11[i__ + i__ * x11_dim1], &c__1));
985 clarfgp_(&i__2, &x11[i__ + i__ * x11_dim1], &x11[i__ + 1 +
986 i__ * x11_dim1], &c__1, &taup1[i__]);
987 } else if (*p == i__) {
989 clarfgp_(&i__2, &x11[i__ + i__ * x11_dim1], &x11[i__ + i__ *
990 x11_dim1], &c__1, &taup1[i__]);
992 i__2 = i__ + i__ * x11_dim1;
993 x11[i__2].r = 1.f, x11[i__2].i = 0.f;
995 i__2 = *m - *p - i__ + 1;
996 clarfgp_(&i__2, &x21[i__ + i__ * x21_dim1], &x21[i__ + 1 +
997 i__ * x21_dim1], &c__1, &taup2[i__]);
998 } else if (*m - *p == i__) {
999 i__2 = *m - *p - i__ + 1;
1000 clarfgp_(&i__2, &x21[i__ + i__ * x21_dim1], &x21[i__ + i__ *
1001 x21_dim1], &c__1, &taup2[i__]);
1003 i__2 = i__ + i__ * x21_dim1;
1004 x21[i__2].r = 1.f, x21[i__2].i = 0.f;
1007 i__2 = *p - i__ + 1;
1009 r_cnjg(&q__1, &taup1[i__]);
1010 clarf_("L", &i__2, &i__3, &x11[i__ + i__ * x11_dim1], &c__1, &
1011 q__1, &x11[i__ + (i__ + 1) * x11_dim1], ldx11, &work[
1013 i__2 = *m - *p - i__ + 1;
1015 r_cnjg(&q__1, &taup2[i__]);
1016 clarf_("L", &i__2, &i__3, &x21[i__ + i__ * x21_dim1], &c__1, &
1017 q__1, &x21[i__ + (i__ + 1) * x21_dim1], ldx21, &work[
1020 if (*m - *q + 1 > i__) {
1021 i__2 = *p - i__ + 1;
1022 i__3 = *m - *q - i__ + 1;
1023 r_cnjg(&q__1, &taup1[i__]);
1024 clarf_("L", &i__2, &i__3, &x11[i__ + i__ * x11_dim1], &c__1, &
1025 q__1, &x12[i__ + i__ * x12_dim1], ldx12, &work[1]);
1026 i__2 = *m - *p - i__ + 1;
1027 i__3 = *m - *q - i__ + 1;
1028 r_cnjg(&q__1, &taup2[i__]);
1029 clarf_("L", &i__2, &i__3, &x21[i__ + i__ * x21_dim1], &c__1, &
1030 q__1, &x22[i__ + i__ * x22_dim1], ldx22, &work[1]);
1035 r__1 = -z1 * z3 * sin(theta[i__]);
1036 q__1.r = r__1, q__1.i = 0.f;
1037 cscal_(&i__2, &q__1, &x11[i__ + (i__ + 1) * x11_dim1], ldx11);
1039 r__1 = z2 * z3 * cos(theta[i__]);
1040 q__1.r = r__1, q__1.i = 0.f;
1041 caxpy_(&i__2, &q__1, &x21[i__ + (i__ + 1) * x21_dim1], ldx21,
1042 &x11[i__ + (i__ + 1) * x11_dim1], ldx11);
1044 i__2 = *m - *q - i__ + 1;
1045 r__1 = -z1 * z4 * sin(theta[i__]);
1046 q__1.r = r__1, q__1.i = 0.f;
1047 cscal_(&i__2, &q__1, &x12[i__ + i__ * x12_dim1], ldx12);
1048 i__2 = *m - *q - i__ + 1;
1049 r__1 = z2 * z4 * cos(theta[i__]);
1050 q__1.r = r__1, q__1.i = 0.f;
1051 caxpy_(&i__2, &q__1, &x22[i__ + i__ * x22_dim1], ldx22, &x12[i__
1052 + i__ * x12_dim1], ldx12);
1056 i__3 = *m - *q - i__ + 1;
1057 phi[i__] = atan2(scnrm2_(&i__2, &x11[i__ + (i__ + 1) *
1058 x11_dim1], ldx11), scnrm2_(&i__3, &x12[i__ + i__ *
1064 clacgv_(&i__2, &x11[i__ + (i__ + 1) * x11_dim1], ldx11);
1065 if (i__ == *q - 1) {
1067 clarfgp_(&i__2, &x11[i__ + (i__ + 1) * x11_dim1], &x11[
1068 i__ + (i__ + 1) * x11_dim1], ldx11, &tauq1[i__]);
1071 clarfgp_(&i__2, &x11[i__ + (i__ + 1) * x11_dim1], &x11[
1072 i__ + (i__ + 2) * x11_dim1], ldx11, &tauq1[i__]);
1074 i__2 = i__ + (i__ + 1) * x11_dim1;
1075 x11[i__2].r = 1.f, x11[i__2].i = 0.f;
1077 if (*m - *q + 1 > i__) {
1078 i__2 = *m - *q - i__ + 1;
1079 clacgv_(&i__2, &x12[i__ + i__ * x12_dim1], ldx12);
1080 if (*m - *q == i__) {
1081 i__2 = *m - *q - i__ + 1;
1082 clarfgp_(&i__2, &x12[i__ + i__ * x12_dim1], &x12[i__ +
1083 i__ * x12_dim1], ldx12, &tauq2[i__]);
1085 i__2 = *m - *q - i__ + 1;
1086 clarfgp_(&i__2, &x12[i__ + i__ * x12_dim1], &x12[i__ + (
1087 i__ + 1) * x12_dim1], ldx12, &tauq2[i__]);
1090 i__2 = i__ + i__ * x12_dim1;
1091 x12[i__2].r = 1.f, x12[i__2].i = 0.f;
1096 clarf_("R", &i__2, &i__3, &x11[i__ + (i__ + 1) * x11_dim1],
1097 ldx11, &tauq1[i__], &x11[i__ + 1 + (i__ + 1) *
1098 x11_dim1], ldx11, &work[1]);
1099 i__2 = *m - *p - i__;
1101 clarf_("R", &i__2, &i__3, &x11[i__ + (i__ + 1) * x11_dim1],
1102 ldx11, &tauq1[i__], &x21[i__ + 1 + (i__ + 1) *
1103 x21_dim1], ldx21, &work[1]);
1107 i__3 = *m - *q - i__ + 1;
1108 clarf_("R", &i__2, &i__3, &x12[i__ + i__ * x12_dim1], ldx12, &
1109 tauq2[i__], &x12[i__ + 1 + i__ * x12_dim1], ldx12, &
1112 if (*m - *p > i__) {
1113 i__2 = *m - *p - i__;
1114 i__3 = *m - *q - i__ + 1;
1115 clarf_("R", &i__2, &i__3, &x12[i__ + i__ * x12_dim1], ldx12, &
1116 tauq2[i__], &x22[i__ + 1 + i__ * x22_dim1], ldx22, &
1122 clacgv_(&i__2, &x11[i__ + (i__ + 1) * x11_dim1], ldx11);
1124 i__2 = *m - *q - i__ + 1;
1125 clacgv_(&i__2, &x12[i__ + i__ * x12_dim1], ldx12);
1129 /* Reduce columns Q + 1, ..., P of X12, X22 */
1132 for (i__ = *q + 1; i__ <= i__1; ++i__) {
1134 i__2 = *m - *q - i__ + 1;
1136 q__1.r = r__1, q__1.i = 0.f;
1137 cscal_(&i__2, &q__1, &x12[i__ + i__ * x12_dim1], ldx12);
1138 i__2 = *m - *q - i__ + 1;
1139 clacgv_(&i__2, &x12[i__ + i__ * x12_dim1], ldx12);
1140 if (i__ >= *m - *q) {
1141 i__2 = *m - *q - i__ + 1;
1142 clarfgp_(&i__2, &x12[i__ + i__ * x12_dim1], &x12[i__ + i__ *
1143 x12_dim1], ldx12, &tauq2[i__]);
1145 i__2 = *m - *q - i__ + 1;
1146 clarfgp_(&i__2, &x12[i__ + i__ * x12_dim1], &x12[i__ + (i__ +
1147 1) * x12_dim1], ldx12, &tauq2[i__]);
1149 i__2 = i__ + i__ * x12_dim1;
1150 x12[i__2].r = 1.f, x12[i__2].i = 0.f;
1154 i__3 = *m - *q - i__ + 1;
1155 clarf_("R", &i__2, &i__3, &x12[i__ + i__ * x12_dim1], ldx12, &
1156 tauq2[i__], &x12[i__ + 1 + i__ * x12_dim1], ldx12, &
1159 if (*m - *p - *q >= 1) {
1160 i__2 = *m - *p - *q;
1161 i__3 = *m - *q - i__ + 1;
1162 clarf_("R", &i__2, &i__3, &x12[i__ + i__ * x12_dim1], ldx12, &
1163 tauq2[i__], &x22[*q + 1 + i__ * x22_dim1], ldx22, &
1167 i__2 = *m - *q - i__ + 1;
1168 clacgv_(&i__2, &x12[i__ + i__ * x12_dim1], ldx12);
1172 /* Reduce columns P + 1, ..., M - Q of X12, X22 */
1174 i__1 = *m - *p - *q;
1175 for (i__ = 1; i__ <= i__1; ++i__) {
1177 i__2 = *m - *p - *q - i__ + 1;
1179 q__1.r = r__1, q__1.i = 0.f;
1180 cscal_(&i__2, &q__1, &x22[*q + i__ + (*p + i__) * x22_dim1],
1182 i__2 = *m - *p - *q - i__ + 1;
1183 clacgv_(&i__2, &x22[*q + i__ + (*p + i__) * x22_dim1], ldx22);
1184 i__2 = *m - *p - *q - i__ + 1;
1185 clarfgp_(&i__2, &x22[*q + i__ + (*p + i__) * x22_dim1], &x22[*q +
1186 i__ + (*p + i__ + 1) * x22_dim1], ldx22, &tauq2[*p + i__])
1188 i__2 = *q + i__ + (*p + i__) * x22_dim1;
1189 x22[i__2].r = 1.f, x22[i__2].i = 0.f;
1190 i__2 = *m - *p - *q - i__;
1191 i__3 = *m - *p - *q - i__ + 1;
1192 clarf_("R", &i__2, &i__3, &x22[*q + i__ + (*p + i__) * x22_dim1],
1193 ldx22, &tauq2[*p + i__], &x22[*q + i__ + 1 + (*p + i__) *
1194 x22_dim1], ldx22, &work[1]);
1196 i__2 = *m - *p - *q - i__ + 1;
1197 clacgv_(&i__2, &x22[*q + i__ + (*p + i__) * x22_dim1], ldx22);
1203 /* Reduce columns 1, ..., Q of X11, X12, X21, X22 */
1206 for (i__ = 1; i__ <= i__1; ++i__) {
1209 i__2 = *p - i__ + 1;
1210 q__1.r = z1, q__1.i = 0.f;
1211 cscal_(&i__2, &q__1, &x11[i__ + i__ * x11_dim1], ldx11);
1213 i__2 = *p - i__ + 1;
1214 r__1 = z1 * cos(phi[i__ - 1]);
1215 q__1.r = r__1, q__1.i = 0.f;
1216 cscal_(&i__2, &q__1, &x11[i__ + i__ * x11_dim1], ldx11);
1217 i__2 = *p - i__ + 1;
1218 r__1 = -z1 * z3 * z4 * sin(phi[i__ - 1]);
1219 q__1.r = r__1, q__1.i = 0.f;
1220 caxpy_(&i__2, &q__1, &x12[i__ - 1 + i__ * x12_dim1], ldx12, &
1221 x11[i__ + i__ * x11_dim1], ldx11);
1224 i__2 = *m - *p - i__ + 1;
1225 q__1.r = z2, q__1.i = 0.f;
1226 cscal_(&i__2, &q__1, &x21[i__ + i__ * x21_dim1], ldx21);
1228 i__2 = *m - *p - i__ + 1;
1229 r__1 = z2 * cos(phi[i__ - 1]);
1230 q__1.r = r__1, q__1.i = 0.f;
1231 cscal_(&i__2, &q__1, &x21[i__ + i__ * x21_dim1], ldx21);
1232 i__2 = *m - *p - i__ + 1;
1233 r__1 = -z2 * z3 * z4 * sin(phi[i__ - 1]);
1234 q__1.r = r__1, q__1.i = 0.f;
1235 caxpy_(&i__2, &q__1, &x22[i__ - 1 + i__ * x22_dim1], ldx22, &
1236 x21[i__ + i__ * x21_dim1], ldx21);
1239 i__2 = *m - *p - i__ + 1;
1240 i__3 = *p - i__ + 1;
1241 theta[i__] = atan2(scnrm2_(&i__2, &x21[i__ + i__ * x21_dim1],
1242 ldx21), scnrm2_(&i__3, &x11[i__ + i__ * x11_dim1], ldx11))
1245 i__2 = *p - i__ + 1;
1246 clacgv_(&i__2, &x11[i__ + i__ * x11_dim1], ldx11);
1247 i__2 = *m - *p - i__ + 1;
1248 clacgv_(&i__2, &x21[i__ + i__ * x21_dim1], ldx21);
1250 i__2 = *p - i__ + 1;
1251 clarfgp_(&i__2, &x11[i__ + i__ * x11_dim1], &x11[i__ + (i__ + 1) *
1252 x11_dim1], ldx11, &taup1[i__]);
1253 i__2 = i__ + i__ * x11_dim1;
1254 x11[i__2].r = 1.f, x11[i__2].i = 0.f;
1255 if (i__ == *m - *p) {
1256 i__2 = *m - *p - i__ + 1;
1257 clarfgp_(&i__2, &x21[i__ + i__ * x21_dim1], &x21[i__ + i__ *
1258 x21_dim1], ldx21, &taup2[i__]);
1260 i__2 = *m - *p - i__ + 1;
1261 clarfgp_(&i__2, &x21[i__ + i__ * x21_dim1], &x21[i__ + (i__ +
1262 1) * x21_dim1], ldx21, &taup2[i__]);
1264 i__2 = i__ + i__ * x21_dim1;
1265 x21[i__2].r = 1.f, x21[i__2].i = 0.f;
1268 i__3 = *p - i__ + 1;
1269 clarf_("R", &i__2, &i__3, &x11[i__ + i__ * x11_dim1], ldx11, &
1270 taup1[i__], &x11[i__ + 1 + i__ * x11_dim1], ldx11, &work[
1272 i__2 = *m - *q - i__ + 1;
1273 i__3 = *p - i__ + 1;
1274 clarf_("R", &i__2, &i__3, &x11[i__ + i__ * x11_dim1], ldx11, &
1275 taup1[i__], &x12[i__ + i__ * x12_dim1], ldx12, &work[1]);
1277 i__3 = *m - *p - i__ + 1;
1278 clarf_("R", &i__2, &i__3, &x21[i__ + i__ * x21_dim1], ldx21, &
1279 taup2[i__], &x21[i__ + 1 + i__ * x21_dim1], ldx21, &work[
1281 i__2 = *m - *q - i__ + 1;
1282 i__3 = *m - *p - i__ + 1;
1283 clarf_("R", &i__2, &i__3, &x21[i__ + i__ * x21_dim1], ldx21, &
1284 taup2[i__], &x22[i__ + i__ * x22_dim1], ldx22, &work[1]);
1286 i__2 = *p - i__ + 1;
1287 clacgv_(&i__2, &x11[i__ + i__ * x11_dim1], ldx11);
1288 i__2 = *m - *p - i__ + 1;
1289 clacgv_(&i__2, &x21[i__ + i__ * x21_dim1], ldx21);
1293 r__1 = -z1 * z3 * sin(theta[i__]);
1294 q__1.r = r__1, q__1.i = 0.f;
1295 cscal_(&i__2, &q__1, &x11[i__ + 1 + i__ * x11_dim1], &c__1);
1297 r__1 = z2 * z3 * cos(theta[i__]);
1298 q__1.r = r__1, q__1.i = 0.f;
1299 caxpy_(&i__2, &q__1, &x21[i__ + 1 + i__ * x21_dim1], &c__1, &
1300 x11[i__ + 1 + i__ * x11_dim1], &c__1);
1302 i__2 = *m - *q - i__ + 1;
1303 r__1 = -z1 * z4 * sin(theta[i__]);
1304 q__1.r = r__1, q__1.i = 0.f;
1305 cscal_(&i__2, &q__1, &x12[i__ + i__ * x12_dim1], &c__1);
1306 i__2 = *m - *q - i__ + 1;
1307 r__1 = z2 * z4 * cos(theta[i__]);
1308 q__1.r = r__1, q__1.i = 0.f;
1309 caxpy_(&i__2, &q__1, &x22[i__ + i__ * x22_dim1], &c__1, &x12[i__
1310 + i__ * x12_dim1], &c__1);
1314 i__3 = *m - *q - i__ + 1;
1315 phi[i__] = atan2(scnrm2_(&i__2, &x11[i__ + 1 + i__ * x11_dim1]
1316 , &c__1), scnrm2_(&i__3, &x12[i__ + i__ * x12_dim1], &
1322 clarfgp_(&i__2, &x11[i__ + 1 + i__ * x11_dim1], &x11[i__ + 2
1323 + i__ * x11_dim1], &c__1, &tauq1[i__]);
1324 i__2 = i__ + 1 + i__ * x11_dim1;
1325 x11[i__2].r = 1.f, x11[i__2].i = 0.f;
1327 i__2 = *m - *q - i__ + 1;
1328 clarfgp_(&i__2, &x12[i__ + i__ * x12_dim1], &x12[i__ + 1 + i__ *
1329 x12_dim1], &c__1, &tauq2[i__]);
1330 i__2 = i__ + i__ * x12_dim1;
1331 x12[i__2].r = 1.f, x12[i__2].i = 0.f;
1336 r_cnjg(&q__1, &tauq1[i__]);
1337 clarf_("L", &i__2, &i__3, &x11[i__ + 1 + i__ * x11_dim1], &
1338 c__1, &q__1, &x11[i__ + 1 + (i__ + 1) * x11_dim1],
1341 i__3 = *m - *p - i__;
1342 r_cnjg(&q__1, &tauq1[i__]);
1343 clarf_("L", &i__2, &i__3, &x11[i__ + 1 + i__ * x11_dim1], &
1344 c__1, &q__1, &x21[i__ + 1 + (i__ + 1) * x21_dim1],
1347 i__2 = *m - *q - i__ + 1;
1349 r_cnjg(&q__1, &tauq2[i__]);
1350 clarf_("L", &i__2, &i__3, &x12[i__ + i__ * x12_dim1], &c__1, &
1351 q__1, &x12[i__ + (i__ + 1) * x12_dim1], ldx12, &work[1]);
1352 if (*m - *p > i__) {
1353 i__2 = *m - *q - i__ + 1;
1354 i__3 = *m - *p - i__;
1355 r_cnjg(&q__1, &tauq2[i__]);
1356 clarf_("L", &i__2, &i__3, &x12[i__ + i__ * x12_dim1], &c__1, &
1357 q__1, &x22[i__ + (i__ + 1) * x22_dim1], ldx22, &work[
1362 /* Reduce columns Q + 1, ..., P of X12, X22 */
1365 for (i__ = *q + 1; i__ <= i__1; ++i__) {
1367 i__2 = *m - *q - i__ + 1;
1369 q__1.r = r__1, q__1.i = 0.f;
1370 cscal_(&i__2, &q__1, &x12[i__ + i__ * x12_dim1], &c__1);
1371 i__2 = *m - *q - i__ + 1;
1372 clarfgp_(&i__2, &x12[i__ + i__ * x12_dim1], &x12[i__ + 1 + i__ *
1373 x12_dim1], &c__1, &tauq2[i__]);
1374 i__2 = i__ + i__ * x12_dim1;
1375 x12[i__2].r = 1.f, x12[i__2].i = 0.f;
1378 i__2 = *m - *q - i__ + 1;
1380 r_cnjg(&q__1, &tauq2[i__]);
1381 clarf_("L", &i__2, &i__3, &x12[i__ + i__ * x12_dim1], &c__1, &
1382 q__1, &x12[i__ + (i__ + 1) * x12_dim1], ldx12, &work[
1385 if (*m - *p - *q >= 1) {
1386 i__2 = *m - *q - i__ + 1;
1387 i__3 = *m - *p - *q;
1388 r_cnjg(&q__1, &tauq2[i__]);
1389 clarf_("L", &i__2, &i__3, &x12[i__ + i__ * x12_dim1], &c__1, &
1390 q__1, &x22[i__ + (*q + 1) * x22_dim1], ldx22, &work[1]
1396 /* Reduce columns P + 1, ..., M - Q of X12, X22 */
1398 i__1 = *m - *p - *q;
1399 for (i__ = 1; i__ <= i__1; ++i__) {
1401 i__2 = *m - *p - *q - i__ + 1;
1403 q__1.r = r__1, q__1.i = 0.f;
1404 cscal_(&i__2, &q__1, &x22[*p + i__ + (*q + i__) * x22_dim1], &
1406 i__2 = *m - *p - *q - i__ + 1;
1407 clarfgp_(&i__2, &x22[*p + i__ + (*q + i__) * x22_dim1], &x22[*p +
1408 i__ + 1 + (*q + i__) * x22_dim1], &c__1, &tauq2[*p + i__])
1410 i__2 = *p + i__ + (*q + i__) * x22_dim1;
1411 x22[i__2].r = 1.f, x22[i__2].i = 0.f;
1412 if (*m - *p - *q != i__) {
1413 i__2 = *m - *p - *q - i__ + 1;
1414 i__3 = *m - *p - *q - i__;
1415 r_cnjg(&q__1, &tauq2[*p + i__]);
1416 clarf_("L", &i__2, &i__3, &x22[*p + i__ + (*q + i__) *
1417 x22_dim1], &c__1, &q__1, &x22[*p + i__ + (*q + i__ +
1418 1) * x22_dim1], ldx22, &work[1]);