210 SUBROUTINE zunbdb4( M, P, Q, X11, LDX11, X21, LDX21, THETA, PHI,
211 $ TAUP1, TAUP2, TAUQ1, PHANTOM, WORK, LWORK,
219 INTEGER INFO, LWORK, M, P, Q, LDX11, LDX21
222 DOUBLE PRECISION PHI(*), THETA(*)
223 COMPLEX*16 PHANTOM(*), TAUP1(*), TAUP2(*), TAUQ1(*),
224 $ work(*), x11(ldx11,*), x21(ldx21,*)
230 COMPLEX*16 NEGONE, ONE, ZERO
231 PARAMETER ( NEGONE = (-1.0d0,0.0d0), one = (1.0d0,0.0d0),
232 $ zero = (0.0d0,0.0d0) )
235 DOUBLE PRECISION C, S
236 INTEGER CHILDINFO, I, ILARF, IORBDB5, J, LLARF,
237 $ lorbdb5, lworkmin, lworkopt
245 DOUBLE PRECISION DZNRM2
249 INTRINSIC atan2, cos, max, sin, sqrt
256 lquery = lwork .EQ. -1
260 ELSE IF( p .LT. m-q .OR. m-p .LT. m-q )
THEN
262 ELSE IF( q .LT. m-q .OR. q .GT. m )
THEN
264 ELSE IF( ldx11 .LT. max( 1, p ) )
THEN
266 ELSE IF( ldx21 .LT. max( 1, m-p ) )
THEN
272 IF( info .EQ. 0 )
THEN
274 llarf = max( q-1, p-1, m-p-1 )
277 lworkopt = ilarf + llarf - 1
278 lworkopt = max( lworkopt, iorbdb5 + lorbdb5 - 1 )
281 IF( lwork .LT. lworkmin .AND. .NOT.lquery )
THEN
285 IF( info .NE. 0 )
THEN
286 CALL xerbla(
'ZUNBDB4', -info )
288 ELSE IF( lquery )
THEN
300 CALL zunbdb5( p, m-p, q, phantom(1), 1, phantom(p+1), 1,
301 $ x11, ldx11, x21, ldx21, work(iorbdb5),
302 $ lorbdb5, childinfo )
303 CALL zscal( p, negone, phantom(1), 1 )
304 CALL zlarfgp( p, phantom(1), phantom(2), 1, taup1(1) )
305 CALL zlarfgp( m-p, phantom(p+1), phantom(p+2), 1, taup2(1) )
306 theta(i) = atan2( dble( phantom(1) ), dble( phantom(p+1) ) )
311 CALL zlarf(
'L', p, q, phantom(1), 1, dconjg(taup1(1)), x11,
312 $ ldx11, work(ilarf) )
313 CALL zlarf(
'L', m-p, q, phantom(p+1), 1, dconjg(taup2(1)),
314 $ x21, ldx21, work(ilarf) )
316 CALL zunbdb5( p-i+1, m-p-i+1, q-i+1, x11(i,i-1), 1,
317 $ x21(i,i-1), 1, x11(i,i), ldx11, x21(i,i),
318 $ ldx21, work(iorbdb5), lorbdb5, childinfo )
319 CALL zscal( p-i+1, negone, x11(i,i-1), 1 )
320 CALL zlarfgp( p-i+1, x11(i,i-1), x11(i+1,i-1), 1, taup1(i) )
321 CALL zlarfgp( m-p-i+1, x21(i,i-1), x21(i+1,i-1), 1,
323 theta(i) = atan2( dble( x11(i,i-1) ), dble( x21(i,i-1) ) )
328 CALL zlarf(
'L', p-i+1, q-i+1, x11(i,i-1), 1,
329 $ dconjg(taup1(i)), x11(i,i), ldx11, work(ilarf) )
330 CALL zlarf(
'L', m-p-i+1, q-i+1, x21(i,i-1), 1,
331 $ dconjg(taup2(i)), x21(i,i), ldx21, work(ilarf) )
334 CALL zdrot( q-i+1, x11(i,i), ldx11, x21(i,i), ldx21, s, -c )
335 CALL zlacgv( q-i+1, x21(i,i), ldx21 )
336 CALL zlarfgp( q-i+1, x21(i,i), x21(i,i+1), ldx21, tauq1(i) )
339 CALL zlarf(
'R', p-i, q-i+1, x21(i,i), ldx21, tauq1(i),
340 $ x11(i+1,i), ldx11, work(ilarf) )
341 CALL zlarf(
'R', m-p-i, q-i+1, x21(i,i), ldx21, tauq1(i),
342 $ x21(i+1,i), ldx21, work(ilarf) )
343 CALL zlacgv( q-i+1, x21(i,i), ldx21 )
344 IF( i .LT. m-q )
THEN
345 s = sqrt( dznrm2( p-i, x11(i+1,i), 1 )**2
346 $ + dznrm2( m-p-i, x21(i+1,i), 1 )**2 )
347 phi(i) = atan2( s, c )
355 CALL zlacgv( q-i+1, x11(i,i), ldx11 )
356 CALL zlarfgp( q-i+1, x11(i,i), x11(i,i+1), ldx11, tauq1(i) )
358 CALL zlarf(
'R', p-i, q-i+1, x11(i,i), ldx11, tauq1(i),
359 $ x11(i+1,i), ldx11, work(ilarf) )
360 CALL zlarf(
'R', q-p, q-i+1, x11(i,i), ldx11, tauq1(i),
361 $ x21(m-q+1,i), ldx21, work(ilarf) )
362 CALL zlacgv( q-i+1, x11(i,i), ldx11 )
368 CALL zlacgv( q-i+1, x21(m-q+i-p,i), ldx21 )
369 CALL zlarfgp( q-i+1, x21(m-q+i-p,i), x21(m-q+i-p,i+1), ldx21,
372 CALL zlarf(
'R', q-i, q-i+1, x21(m-q+i-p,i), ldx21, tauq1(i),
373 $ x21(m-q+i-p+1,i), ldx21, work(ilarf) )
374 CALL zlacgv( q-i+1, x21(m-q+i-p,i), ldx21 )
subroutine xerbla(srname, info)
subroutine zlacgv(n, x, incx)
ZLACGV conjugates a complex vector.
subroutine zlarf(side, m, n, v, incv, tau, c, ldc, work)
ZLARF applies an elementary reflector to a general rectangular matrix.
subroutine zlarfgp(n, alpha, x, incx, tau)
ZLARFGP generates an elementary reflector (Householder matrix) with non-negative beta.
subroutine zdrot(n, zx, incx, zy, incy, c, s)
ZDROT
subroutine zscal(n, za, zx, incx)
ZSCAL
subroutine zunbdb4(m, p, q, x11, ldx11, x21, ldx21, theta, phi, taup1, taup2, tauq1, phantom, work, lwork, info)
ZUNBDB4
subroutine zunbdb5(m1, m2, n, x1, incx1, x2, incx2, q1, ldq1, q2, ldq2, work, lwork, info)
ZUNBDB5