LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zunbdb.f
Go to the documentation of this file.
1*> \brief \b ZUNBDB
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZUNBDB + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zunbdb.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zunbdb.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zunbdb.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE ZUNBDB( TRANS, SIGNS, M, P, Q, X11, LDX11, X12, LDX12,
20* X21, LDX21, X22, LDX22, THETA, PHI, TAUP1,
21* TAUP2, TAUQ1, TAUQ2, WORK, LWORK, INFO )
22*
23* .. Scalar Arguments ..
24* CHARACTER SIGNS, TRANS
25* INTEGER INFO, LDX11, LDX12, LDX21, LDX22, LWORK, M, P,
26* $ Q
27* ..
28* .. Array Arguments ..
29* DOUBLE PRECISION PHI( * ), THETA( * )
30* COMPLEX*16 TAUP1( * ), TAUP2( * ), TAUQ1( * ), TAUQ2( * ),
31* $ WORK( * ), X11( LDX11, * ), X12( LDX12, * ),
32* $ X21( LDX21, * ), X22( LDX22, * )
33* ..
34*
35*
36*> \par Purpose:
37* =============
38*>
39*> \verbatim
40*>
41*> ZUNBDB simultaneously bidiagonalizes the blocks of an M-by-M
42*> partitioned unitary matrix X:
43*>
44*> [ B11 | B12 0 0 ]
45*> [ X11 | X12 ] [ P1 | ] [ 0 | 0 -I 0 ] [ Q1 | ]**H
46*> X = [-----------] = [---------] [----------------] [---------] .
47*> [ X21 | X22 ] [ | P2 ] [ B21 | B22 0 0 ] [ | Q2 ]
48*> [ 0 | 0 0 I ]
49*>
50*> X11 is P-by-Q. Q must be no larger than P, M-P, or M-Q. (If this is
51*> not the case, then X must be transposed and/or permuted. This can be
52*> done in constant time using the TRANS and SIGNS options. See ZUNCSD
53*> for details.)
54*>
55*> The unitary matrices P1, P2, Q1, and Q2 are P-by-P, (M-P)-by-
56*> (M-P), Q-by-Q, and (M-Q)-by-(M-Q), respectively. They are
57*> represented implicitly by Householder vectors.
58*>
59*> B11, B12, B21, and B22 are Q-by-Q bidiagonal matrices represented
60*> implicitly by angles THETA, PHI.
61*> \endverbatim
62*
63* Arguments:
64* ==========
65*
66*> \param[in] TRANS
67*> \verbatim
68*> TRANS is CHARACTER
69*> = 'T': X, U1, U2, V1T, and V2T are stored in row-major
70*> order;
71*> otherwise: X, U1, U2, V1T, and V2T are stored in column-
72*> major order.
73*> \endverbatim
74*>
75*> \param[in] SIGNS
76*> \verbatim
77*> SIGNS is CHARACTER
78*> = 'O': The lower-left block is made nonpositive (the
79*> "other" convention);
80*> otherwise: The upper-right block is made nonpositive (the
81*> "default" convention).
82*> \endverbatim
83*>
84*> \param[in] M
85*> \verbatim
86*> M is INTEGER
87*> The number of rows and columns in X.
88*> \endverbatim
89*>
90*> \param[in] P
91*> \verbatim
92*> P is INTEGER
93*> The number of rows in X11 and X12. 0 <= P <= M.
94*> \endverbatim
95*>
96*> \param[in] Q
97*> \verbatim
98*> Q is INTEGER
99*> The number of columns in X11 and X21. 0 <= Q <=
100*> MIN(P,M-P,M-Q).
101*> \endverbatim
102*>
103*> \param[in,out] X11
104*> \verbatim
105*> X11 is COMPLEX*16 array, dimension (LDX11,Q)
106*> On entry, the top-left block of the unitary matrix to be
107*> reduced. On exit, the form depends on TRANS:
108*> If TRANS = 'N', then
109*> the columns of tril(X11) specify reflectors for P1,
110*> the rows of triu(X11,1) specify reflectors for Q1;
111*> else TRANS = 'T', and
112*> the rows of triu(X11) specify reflectors for P1,
113*> the columns of tril(X11,-1) specify reflectors for Q1.
114*> \endverbatim
115*>
116*> \param[in] LDX11
117*> \verbatim
118*> LDX11 is INTEGER
119*> The leading dimension of X11. If TRANS = 'N', then LDX11 >=
120*> P; else LDX11 >= Q.
121*> \endverbatim
122*>
123*> \param[in,out] X12
124*> \verbatim
125*> X12 is COMPLEX*16 array, dimension (LDX12,M-Q)
126*> On entry, the top-right block of the unitary matrix to
127*> be reduced. On exit, the form depends on TRANS:
128*> If TRANS = 'N', then
129*> the rows of triu(X12) specify the first P reflectors for
130*> Q2;
131*> else TRANS = 'T', and
132*> the columns of tril(X12) specify the first P reflectors
133*> for Q2.
134*> \endverbatim
135*>
136*> \param[in] LDX12
137*> \verbatim
138*> LDX12 is INTEGER
139*> The leading dimension of X12. If TRANS = 'N', then LDX12 >=
140*> P; else LDX11 >= M-Q.
141*> \endverbatim
142*>
143*> \param[in,out] X21
144*> \verbatim
145*> X21 is COMPLEX*16 array, dimension (LDX21,Q)
146*> On entry, the bottom-left block of the unitary matrix to
147*> be reduced. On exit, the form depends on TRANS:
148*> If TRANS = 'N', then
149*> the columns of tril(X21) specify reflectors for P2;
150*> else TRANS = 'T', and
151*> the rows of triu(X21) specify reflectors for P2.
152*> \endverbatim
153*>
154*> \param[in] LDX21
155*> \verbatim
156*> LDX21 is INTEGER
157*> The leading dimension of X21. If TRANS = 'N', then LDX21 >=
158*> M-P; else LDX21 >= Q.
159*> \endverbatim
160*>
161*> \param[in,out] X22
162*> \verbatim
163*> X22 is COMPLEX*16 array, dimension (LDX22,M-Q)
164*> On entry, the bottom-right block of the unitary matrix to
165*> be reduced. On exit, the form depends on TRANS:
166*> If TRANS = 'N', then
167*> the rows of triu(X22(Q+1:M-P,P+1:M-Q)) specify the last
168*> M-P-Q reflectors for Q2,
169*> else TRANS = 'T', and
170*> the columns of tril(X22(P+1:M-Q,Q+1:M-P)) specify the last
171*> M-P-Q reflectors for P2.
172*> \endverbatim
173*>
174*> \param[in] LDX22
175*> \verbatim
176*> LDX22 is INTEGER
177*> The leading dimension of X22. If TRANS = 'N', then LDX22 >=
178*> M-P; else LDX22 >= M-Q.
179*> \endverbatim
180*>
181*> \param[out] THETA
182*> \verbatim
183*> THETA is DOUBLE PRECISION array, dimension (Q)
184*> The entries of the bidiagonal blocks B11, B12, B21, B22 can
185*> be computed from the angles THETA and PHI. See Further
186*> Details.
187*> \endverbatim
188*>
189*> \param[out] PHI
190*> \verbatim
191*> PHI is DOUBLE PRECISION array, dimension (Q-1)
192*> The entries of the bidiagonal blocks B11, B12, B21, B22 can
193*> be computed from the angles THETA and PHI. See Further
194*> Details.
195*> \endverbatim
196*>
197*> \param[out] TAUP1
198*> \verbatim
199*> TAUP1 is COMPLEX*16 array, dimension (P)
200*> The scalar factors of the elementary reflectors that define
201*> P1.
202*> \endverbatim
203*>
204*> \param[out] TAUP2
205*> \verbatim
206*> TAUP2 is COMPLEX*16 array, dimension (M-P)
207*> The scalar factors of the elementary reflectors that define
208*> P2.
209*> \endverbatim
210*>
211*> \param[out] TAUQ1
212*> \verbatim
213*> TAUQ1 is COMPLEX*16 array, dimension (Q)
214*> The scalar factors of the elementary reflectors that define
215*> Q1.
216*> \endverbatim
217*>
218*> \param[out] TAUQ2
219*> \verbatim
220*> TAUQ2 is COMPLEX*16 array, dimension (M-Q)
221*> The scalar factors of the elementary reflectors that define
222*> Q2.
223*> \endverbatim
224*>
225*> \param[out] WORK
226*> \verbatim
227*> WORK is COMPLEX*16 array, dimension (LWORK)
228*> \endverbatim
229*>
230*> \param[in] LWORK
231*> \verbatim
232*> LWORK is INTEGER
233*> The dimension of the array WORK. LWORK >= M-Q.
234*>
235*> If LWORK = -1, then a workspace query is assumed; the routine
236*> only calculates the optimal size of the WORK array, returns
237*> this value as the first entry of the WORK array, and no error
238*> message related to LWORK is issued by XERBLA.
239*> \endverbatim
240*>
241*> \param[out] INFO
242*> \verbatim
243*> INFO is INTEGER
244*> = 0: successful exit.
245*> < 0: if INFO = -i, the i-th argument had an illegal value.
246*> \endverbatim
247*
248* Authors:
249* ========
250*
251*> \author Univ. of Tennessee
252*> \author Univ. of California Berkeley
253*> \author Univ. of Colorado Denver
254*> \author NAG Ltd.
255*
256*> \ingroup unbdb
257*
258*> \par Further Details:
259* =====================
260*>
261*> \verbatim
262*>
263*> The bidiagonal blocks B11, B12, B21, and B22 are represented
264*> implicitly by angles THETA(1), ..., THETA(Q) and PHI(1), ...,
265*> PHI(Q-1). B11 and B21 are upper bidiagonal, while B21 and B22 are
266*> lower bidiagonal. Every entry in each bidiagonal band is a product
267*> of a sine or cosine of a THETA with a sine or cosine of a PHI. See
268*> [1] or ZUNCSD for details.
269*>
270*> P1, P2, Q1, and Q2 are represented as products of elementary
271*> reflectors. See ZUNCSD for details on generating P1, P2, Q1, and Q2
272*> using ZUNGQR and ZUNGLQ.
273*> \endverbatim
274*
275*> \par References:
276* ================
277*>
278*> [1] Brian D. Sutton. Computing the complete CS decomposition. Numer.
279*> Algorithms, 50(1):33-65, 2009.
280*>
281* =====================================================================
282 SUBROUTINE zunbdb( TRANS, SIGNS, M, P, Q, X11, LDX11, X12,
283 $ LDX12,
284 $ X21, LDX21, X22, LDX22, THETA, PHI, TAUP1,
285 $ TAUP2, TAUQ1, TAUQ2, WORK, LWORK, INFO )
286*
287* -- LAPACK computational routine --
288* -- LAPACK is a software package provided by Univ. of Tennessee, --
289* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
290*
291* .. Scalar Arguments ..
292 CHARACTER SIGNS, TRANS
293 INTEGER INFO, LDX11, LDX12, LDX21, LDX22, LWORK, M, P,
294 $ Q
295* ..
296* .. Array Arguments ..
297 DOUBLE PRECISION PHI( * ), THETA( * )
298 COMPLEX*16 TAUP1( * ), TAUP2( * ), TAUQ1( * ), TAUQ2( * ),
299 $ WORK( * ), X11( LDX11, * ), X12( LDX12, * ),
300 $ x21( ldx21, * ), x22( ldx22, * )
301* ..
302*
303* ====================================================================
304*
305* .. Parameters ..
306 DOUBLE PRECISION REALONE
307 PARAMETER ( REALONE = 1.0d0 )
308 COMPLEX*16 ONE
309 parameter( one = (1.0d0,0.0d0) )
310* ..
311* .. Local Scalars ..
312 LOGICAL COLMAJOR, LQUERY
313 INTEGER I, LWORKMIN, LWORKOPT
314 DOUBLE PRECISION Z1, Z2, Z3, Z4
315* ..
316* .. External Subroutines ..
317 EXTERNAL zaxpy, zlarf1f, zlarfgp, zscal,
318 $ xerbla
319 EXTERNAL zlacgv
320*
321* ..
322* .. External Functions ..
323 DOUBLE PRECISION DZNRM2
324 LOGICAL LSAME
325 EXTERNAL DZNRM2, LSAME
326* ..
327* .. Intrinsic Functions
328 INTRINSIC atan2, cos, max, min, sin
329 INTRINSIC dcmplx, dconjg
330* ..
331* .. Executable Statements ..
332*
333* Test input arguments
334*
335 info = 0
336 colmajor = .NOT. lsame( trans, 'T' )
337 IF( .NOT. lsame( signs, 'O' ) ) THEN
338 z1 = realone
339 z2 = realone
340 z3 = realone
341 z4 = realone
342 ELSE
343 z1 = realone
344 z2 = -realone
345 z3 = realone
346 z4 = -realone
347 END IF
348 lquery = lwork .EQ. -1
349*
350 IF( m .LT. 0 ) THEN
351 info = -3
352 ELSE IF( p .LT. 0 .OR. p .GT. m ) THEN
353 info = -4
354 ELSE IF( q .LT. 0 .OR. q .GT. p .OR. q .GT. m-p .OR.
355 $ q .GT. m-q ) THEN
356 info = -5
357 ELSE IF( colmajor .AND. ldx11 .LT. max( 1, p ) ) THEN
358 info = -7
359 ELSE IF( .NOT.colmajor .AND. ldx11 .LT. max( 1, q ) ) THEN
360 info = -7
361 ELSE IF( colmajor .AND. ldx12 .LT. max( 1, p ) ) THEN
362 info = -9
363 ELSE IF( .NOT.colmajor .AND. ldx12 .LT. max( 1, m-q ) ) THEN
364 info = -9
365 ELSE IF( colmajor .AND. ldx21 .LT. max( 1, m-p ) ) THEN
366 info = -11
367 ELSE IF( .NOT.colmajor .AND. ldx21 .LT. max( 1, q ) ) THEN
368 info = -11
369 ELSE IF( colmajor .AND. ldx22 .LT. max( 1, m-p ) ) THEN
370 info = -13
371 ELSE IF( .NOT.colmajor .AND. ldx22 .LT. max( 1, m-q ) ) THEN
372 info = -13
373 END IF
374*
375* Compute workspace
376*
377 IF( info .EQ. 0 ) THEN
378 lworkopt = m - q
379 lworkmin = m - q
380 work(1) = lworkopt
381 IF( lwork .LT. lworkmin .AND. .NOT. lquery ) THEN
382 info = -21
383 END IF
384 END IF
385 IF( info .NE. 0 ) THEN
386 CALL xerbla( 'xORBDB', -info )
387 RETURN
388 ELSE IF( lquery ) THEN
389 RETURN
390 END IF
391*
392* Handle column-major and row-major separately
393*
394 IF( colmajor ) THEN
395*
396* Reduce columns 1, ..., Q of X11, X12, X21, and X22
397*
398 DO i = 1, q
399*
400 IF( i .EQ. 1 ) THEN
401 CALL zscal( p-i+1, dcmplx( z1, 0.0d0 ), x11(i,i), 1 )
402 ELSE
403 CALL zscal( p-i+1, dcmplx( z1*cos(phi(i-1)), 0.0d0 ),
404 $ x11(i,i), 1 )
405 CALL zaxpy( p-i+1, dcmplx( -z1*z3*z4*sin(phi(i-1)),
406 $ 0.0d0 ), x12(i,i-1), 1, x11(i,i), 1 )
407 END IF
408 IF( i .EQ. 1 ) THEN
409 CALL zscal( m-p-i+1, dcmplx( z2, 0.0d0 ), x21(i,i),
410 $ 1 )
411 ELSE
412 CALL zscal( m-p-i+1, dcmplx( z2*cos(phi(i-1)),
413 $ 0.0d0 ),
414 $ x21(i,i), 1 )
415 CALL zaxpy( m-p-i+1, dcmplx( -z2*z3*z4*sin(phi(i-1)),
416 $ 0.0d0 ), x22(i,i-1), 1, x21(i,i), 1 )
417 END IF
418*
419 theta(i) = atan2( dznrm2( m-p-i+1, x21(i,i), 1 ),
420 $ dznrm2( p-i+1, x11(i,i), 1 ) )
421*
422 IF( p .GT. i ) THEN
423 CALL zlarfgp( p-i+1, x11(i,i), x11(i+1,i), 1,
424 $ taup1(i) )
425 ELSE IF ( p .EQ. i ) THEN
426 CALL zlarfgp( p-i+1, x11(i,i), x11(i,i), 1, taup1(i) )
427 END IF
428 IF ( m-p .GT. i ) THEN
429 CALL zlarfgp( m-p-i+1, x21(i,i), x21(i+1,i), 1,
430 $ taup2(i) )
431 ELSE IF ( m-p .EQ. i ) THEN
432 CALL zlarfgp( m-p-i+1, x21(i,i), x21(i,i), 1,
433 $ taup2(i) )
434 END IF
435*
436 IF ( q .GT. i ) THEN
437 CALL zlarf1f( 'L', p-i+1, q-i, x11(i,i), 1,
438 $ conjg(taup1(i)), x11(i,i+1), ldx11,
439 $ work )
440 CALL zlarf1f( 'L', m-p-i+1, q-i, x21(i,i), 1,
441 $ conjg(taup2(i)), x21(i,i+1), ldx21,
442 $ work )
443 END IF
444 IF ( m-q+1 .GT. i ) THEN
445 CALL zlarf1f( 'L', p-i+1, m-q-i+1, x11(i,i), 1,
446 $ conjg(taup1(i)), x12(i,i), ldx12, work )
447 CALL zlarf1f( 'L', m-p-i+1, m-q-i+1, x21(i,i), 1,
448 $ conjg(taup2(i)), x22(i,i), ldx22, work )
449 END IF
450*
451 IF( i .LT. q ) THEN
452 CALL zscal( q-i, dcmplx( -z1*z3*sin(theta(i)),
453 $ 0.0d0 ),
454 $ x11(i,i+1), ldx11 )
455 CALL zaxpy( q-i, dcmplx( z2*z3*cos(theta(i)), 0.0d0 ),
456 $ x21(i,i+1), ldx21, x11(i,i+1), ldx11 )
457 END IF
458 CALL zscal( m-q-i+1, dcmplx( -z1*z4*sin(theta(i)),
459 $ 0.0d0 ),
460 $ x12(i,i), ldx12 )
461 CALL zaxpy( m-q-i+1, dcmplx( z2*z4*cos(theta(i)),
462 $ 0.0d0 ),
463 $ x22(i,i), ldx22, x12(i,i), ldx12 )
464*
465 IF( i .LT. q )
466 $ phi(i) = atan2( dznrm2( q-i, x11(i,i+1), ldx11 ),
467 $ dznrm2( m-q-i+1, x12(i,i), ldx12 ) )
468*
469 IF( i .LT. q ) THEN
470 CALL zlacgv( q-i, x11(i,i+1), ldx11 )
471 IF ( i .EQ. q-1 ) THEN
472 CALL zlarfgp( q-i, x11(i,i+1), x11(i,i+1), ldx11,
473 $ tauq1(i) )
474 ELSE
475 CALL zlarfgp( q-i, x11(i,i+1), x11(i,i+2), ldx11,
476 $ tauq1(i) )
477 END IF
478 END IF
479 IF ( m-q+1 .GT. i ) THEN
480 CALL zlacgv( m-q-i+1, x12(i,i), ldx12 )
481 IF ( m-q .EQ. i ) THEN
482 CALL zlarfgp( m-q-i+1, x12(i,i), x12(i,i), ldx12,
483 $ tauq2(i) )
484 ELSE
485 CALL zlarfgp( m-q-i+1, x12(i,i), x12(i,i+1), ldx12,
486 $ tauq2(i) )
487 END IF
488 END IF
489*
490 IF( i .LT. q ) THEN
491 CALL zlarf1f( 'R', p-i, q-i, x11(i,i+1), ldx11,
492 $ tauq1(i),
493 $ x11(i+1,i+1), ldx11, work )
494 CALL zlarf1f( 'R', m-p-i, q-i, x11(i,i+1), ldx11,
495 $ tauq1(i),
496 $ x21(i+1,i+1), ldx21, work )
497 END IF
498 IF ( p .GT. i ) THEN
499 CALL zlarf1f( 'R', p-i, m-q-i+1, x12(i,i), ldx12,
500 $ tauq2(i),
501 $ x12(i+1,i), ldx12, work )
502 END IF
503 IF ( m-p .GT. i ) THEN
504 CALL zlarf1f( 'R', m-p-i, m-q-i+1, x12(i,i), ldx12,
505 $ tauq2(i), x22(i+1,i), ldx22, work )
506 END IF
507*
508 IF( i .LT. q )
509 $ CALL zlacgv( q-i, x11(i,i+1), ldx11 )
510 CALL zlacgv( m-q-i+1, x12(i,i), ldx12 )
511*
512 END DO
513*
514* Reduce columns Q + 1, ..., P of X12, X22
515*
516 DO i = q + 1, p
517*
518 CALL zscal( m-q-i+1, dcmplx( -z1*z4, 0.0d0 ), x12(i,i),
519 $ ldx12 )
520 CALL zlacgv( m-q-i+1, x12(i,i), ldx12 )
521 IF ( i .GE. m-q ) THEN
522 CALL zlarfgp( m-q-i+1, x12(i,i), x12(i,i), ldx12,
523 $ tauq2(i) )
524 ELSE
525 CALL zlarfgp( m-q-i+1, x12(i,i), x12(i,i+1), ldx12,
526 $ tauq2(i) )
527 END IF
528*
529 IF ( p .GT. i ) THEN
530 CALL zlarf1f( 'R', p-i, m-q-i+1, x12(i,i), ldx12,
531 $ tauq2(i),
532 $ x12(i+1,i), ldx12, work )
533 END IF
534 IF( m-p-q .GE. 1 )
535 $ CALL zlarf1f( 'R', m-p-q, m-q-i+1, x12(i,i), ldx12,
536 $ tauq2(i), x22(q+1,i), ldx22, work )
537*
538 CALL zlacgv( m-q-i+1, x12(i,i), ldx12 )
539*
540 END DO
541*
542* Reduce columns P + 1, ..., M - Q of X12, X22
543*
544 DO i = 1, m - p - q
545*
546 CALL zscal( m-p-q-i+1, dcmplx( z2*z4, 0.0d0 ),
547 $ x22(q+i,p+i), ldx22 )
548 CALL zlacgv( m-p-q-i+1, x22(q+i,p+i), ldx22 )
549 CALL zlarfgp( m-p-q-i+1, x22(q+i,p+i), x22(q+i,p+i+1),
550 $ ldx22, tauq2(p+i) )
551 CALL zlarf1f( 'R', m-p-q-i, m-p-q-i+1, x22(q+i,p+i),
552 $ ldx22, tauq2(p+i), x22(q+i+1,p+i), ldx22,
553 $ work )
554*
555 CALL zlacgv( m-p-q-i+1, x22(q+i,p+i), ldx22 )
556*
557 END DO
558*
559 ELSE
560*
561* Reduce columns 1, ..., Q of X11, X12, X21, X22
562*
563 DO i = 1, q
564*
565 IF( i .EQ. 1 ) THEN
566 CALL zscal( p-i+1, dcmplx( z1, 0.0d0 ), x11(i,i),
567 $ ldx11 )
568 ELSE
569 CALL zscal( p-i+1, dcmplx( z1*cos(phi(i-1)), 0.0d0 ),
570 $ x11(i,i), ldx11 )
571 CALL zaxpy( p-i+1, dcmplx( -z1*z3*z4*sin(phi(i-1)),
572 $ 0.0d0 ), x12(i-1,i), ldx12, x11(i,i), ldx11 )
573 END IF
574 IF( i .EQ. 1 ) THEN
575 CALL zscal( m-p-i+1, dcmplx( z2, 0.0d0 ), x21(i,i),
576 $ ldx21 )
577 ELSE
578 CALL zscal( m-p-i+1, dcmplx( z2*cos(phi(i-1)),
579 $ 0.0d0 ),
580 $ x21(i,i), ldx21 )
581 CALL zaxpy( m-p-i+1, dcmplx( -z2*z3*z4*sin(phi(i-1)),
582 $ 0.0d0 ), x22(i-1,i), ldx22, x21(i,i), ldx21 )
583 END IF
584*
585 theta(i) = atan2( dznrm2( m-p-i+1, x21(i,i), ldx21 ),
586 $ dznrm2( p-i+1, x11(i,i), ldx11 ) )
587*
588 CALL zlacgv( p-i+1, x11(i,i), ldx11 )
589 CALL zlacgv( m-p-i+1, x21(i,i), ldx21 )
590*
591 CALL zlarfgp( p-i+1, x11(i,i), x11(i,i+1), ldx11,
592 $ taup1(i) )
593 IF ( i .EQ. m-p ) THEN
594 CALL zlarfgp( m-p-i+1, x21(i,i), x21(i,i), ldx21,
595 $ taup2(i) )
596 ELSE
597 CALL zlarfgp( m-p-i+1, x21(i,i), x21(i,i+1), ldx21,
598 $ taup2(i) )
599 END IF
600*
601 CALL zlarf1f( 'R', q-i, p-i+1, x11(i,i), ldx11, taup1(i),
602 $ x11(i+1,i), ldx11, work )
603 CALL zlarf1f( 'R', m-q-i+1, p-i+1, x11(i,i), ldx11,
604 $ taup1(i),
605 $ x12(i,i), ldx12, work )
606 CALL zlarf1f( 'R', q-i, m-p-i+1, x21(i,i), ldx21,
607 $ taup2(i), x21(i+1,i), ldx21, work )
608 CALL zlarf1f( 'R', m-q-i+1, m-p-i+1, x21(i,i), ldx21,
609 $ taup2(i), x22(i,i), ldx22, work )
610*
611 CALL zlacgv( p-i+1, x11(i,i), ldx11 )
612 CALL zlacgv( m-p-i+1, x21(i,i), ldx21 )
613*
614 IF( i .LT. q ) THEN
615 CALL zscal( q-i, dcmplx( -z1*z3*sin(theta(i)),
616 $ 0.0d0 ),
617 $ x11(i+1,i), 1 )
618 CALL zaxpy( q-i, dcmplx( z2*z3*cos(theta(i)), 0.0d0 ),
619 $ x21(i+1,i), 1, x11(i+1,i), 1 )
620 END IF
621 CALL zscal( m-q-i+1, dcmplx( -z1*z4*sin(theta(i)),
622 $ 0.0d0 ),
623 $ x12(i,i), 1 )
624 CALL zaxpy( m-q-i+1, dcmplx( z2*z4*cos(theta(i)),
625 $ 0.0d0 ),
626 $ x22(i,i), 1, x12(i,i), 1 )
627*
628 IF( i .LT. q )
629 $ phi(i) = atan2( dznrm2( q-i, x11(i+1,i), 1 ),
630 $ dznrm2( m-q-i+1, x12(i,i), 1 ) )
631*
632 IF( i .LT. q ) THEN
633 CALL zlarfgp( q-i, x11(i+1,i), x11(i+2,i), 1,
634 $ tauq1(i) )
635 END IF
636 CALL zlarfgp( m-q-i+1, x12(i,i), x12(i+1,i), 1,
637 $ tauq2(i) )
638*
639 IF( i .LT. q ) THEN
640 CALL zlarf1f( 'L', q-i, p-i, x11(i+1,i), 1,
641 $ conjg(tauq1(i)), x11(i+1,i+1), ldx11,
642 $ work )
643 CALL zlarf1f( 'L', q-i, m-p-i, x11(i+1,i), 1,
644 $ conjg(tauq1(i)), x21(i+1,i+1), ldx21,
645 $ work )
646 END IF
647 CALL zlarf1f( 'L', m-q-i+1, p-i, x12(i,i), 1,
648 $ conjg(tauq2(i)),
649 $ x12(i,i+1), ldx12, work )
650
651 IF ( m-p .GT. i ) THEN
652 CALL zlarf1f( 'L', m-q-i+1, m-p-i, x12(i,i), 1,
653 $ conjg(tauq2(i)), x22(i,i+1), ldx22,
654 $ work )
655 END IF
656*
657 END DO
658*
659* Reduce columns Q + 1, ..., P of X12, X22
660*
661 DO i = q + 1, p
662*
663 CALL zscal( m-q-i+1, dcmplx( -z1*z4, 0.0d0 ), x12(i,i),
664 $ 1 )
665 CALL zlarfgp( m-q-i+1, x12(i,i), x12(i+1,i), 1,
666 $ tauq2(i) )
667*
668 IF ( p .GT. i ) THEN
669 CALL zlarf1f( 'L', m-q-i+1, p-i, x12(i,i), 1,
670 $ conjg(tauq2(i)), x12(i,i+1), ldx12,
671 $ work )
672 END IF
673 IF( m-p-q .GE. 1 )
674 $ CALL zlarf1f( 'L', m-q-i+1, m-p-q, x12(i,i), 1,
675 $ conjg(tauq2(i)), x22(i,q+1), ldx22,
676 $ work )
677*
678 END DO
679*
680* Reduce columns P + 1, ..., M - Q of X12, X22
681*
682 DO i = 1, m - p - q
683*
684 CALL zscal( m-p-q-i+1, dcmplx( z2*z4, 0.0d0 ),
685 $ x22(p+i,q+i), 1 )
686 CALL zlarfgp( m-p-q-i+1, x22(p+i,q+i), x22(p+i+1,q+i), 1,
687 $ tauq2(p+i) )
688 IF ( m-p-q .NE. i ) THEN
689 CALL zlarf1f( 'L', m-p-q-i+1, m-p-q-i, x22(p+i,q+i),
690 $ 1, conjg(tauq2(p+i)), x22(p+i,q+i+1),
691 $ ldx22, work )
692 END IF
693*
694 END DO
695*
696 END IF
697*
698 RETURN
699*
700* End of ZUNBDB
701*
702 END
703
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zaxpy(n, za, zx, incx, zy, incy)
ZAXPY
Definition zaxpy.f:88
subroutine zlacgv(n, x, incx)
ZLACGV conjugates a complex vector.
Definition zlacgv.f:72
subroutine zlarf1f(side, m, n, v, incv, tau, c, ldc, work)
ZLARF1F applies an elementary reflector to a general rectangular
Definition zlarf1f.f:157
subroutine zlarfgp(n, alpha, x, incx, tau)
ZLARFGP generates an elementary reflector (Householder matrix) with non-negative beta.
Definition zlarfgp.f:102
subroutine zscal(n, za, zx, incx)
ZSCAL
Definition zscal.f:78
subroutine zunbdb(trans, signs, m, p, q, x11, ldx11, x12, ldx12, x21, ldx21, x22, ldx22, theta, phi, taup1, taup2, tauq1, tauq2, work, lwork, info)
ZUNBDB
Definition zunbdb.f:286