210 SUBROUTINE dorbdb4( 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 DOUBLE PRECISION PHANTOM(*), TAUP1(*), TAUP2(*), TAUQ1(*),
224 $ work(*), x11(ldx11,*), x21(ldx21,*)
230 DOUBLE PRECISION NEGONE, ONE, ZERO
231 PARAMETER ( NEGONE = -1.0d0, one = 1.0d0, zero = 0.0d0 )
234 DOUBLE PRECISION C, S
235 INTEGER CHILDINFO, I, ILARF, IORBDB5, J, LLARF,
236 $ lorbdb5, lworkmin, lworkopt
243 DOUBLE PRECISION DNRM2
247 INTRINSIC atan2, cos, max, sin, sqrt
254 lquery = lwork .EQ. -1
258 ELSE IF( p .LT. m-q .OR. m-p .LT. m-q )
THEN
260 ELSE IF( q .LT. m-q .OR. q .GT. m )
THEN
262 ELSE IF( ldx11 .LT. max( 1, p ) )
THEN
264 ELSE IF( ldx21 .LT. max( 1, m-p ) )
THEN
270 IF( info .EQ. 0 )
THEN
272 llarf = max( q-1, p-1, m-p-1 )
275 lworkopt = ilarf + llarf - 1
276 lworkopt = max( lworkopt, iorbdb5 + lorbdb5 - 1 )
279 IF( lwork .LT. lworkmin .AND. .NOT.lquery )
THEN
283 IF( info .NE. 0 )
THEN
284 CALL xerbla(
'DORBDB4', -info )
286 ELSE IF( lquery )
THEN
298 CALL dorbdb5( p, m-p, q, phantom(1), 1, phantom(p+1), 1,
299 $ x11, ldx11, x21, ldx21, work(iorbdb5),
300 $ lorbdb5, childinfo )
301 CALL dscal( p, negone, phantom(1), 1 )
302 CALL dlarfgp( p, phantom(1), phantom(2), 1, taup1(1) )
303 CALL dlarfgp( m-p, phantom(p+1), phantom(p+2), 1, taup2(1) )
304 theta(i) = atan2( phantom(1), phantom(p+1) )
309 CALL dlarf(
'L', p, q, phantom(1), 1, taup1(1), x11, ldx11,
311 CALL dlarf(
'L', m-p, q, phantom(p+1), 1, taup2(1), x21,
312 $ ldx21, work(ilarf) )
314 CALL dorbdb5( p-i+1, m-p-i+1, q-i+1, x11(i,i-1), 1,
315 $ x21(i,i-1), 1, x11(i,i), ldx11, x21(i,i),
316 $ ldx21, work(iorbdb5), lorbdb5, childinfo )
317 CALL dscal( p-i+1, negone, x11(i,i-1), 1 )
318 CALL dlarfgp( p-i+1, x11(i,i-1), x11(i+1,i-1), 1, taup1(i) )
319 CALL dlarfgp( m-p-i+1, x21(i,i-1), x21(i+1,i-1), 1,
321 theta(i) = atan2( x11(i,i-1), x21(i,i-1) )
326 CALL dlarf(
'L', p-i+1, q-i+1, x11(i,i-1), 1, taup1(i),
327 $ x11(i,i), ldx11, work(ilarf) )
328 CALL dlarf(
'L', m-p-i+1, q-i+1, x21(i,i-1), 1, taup2(i),
329 $ x21(i,i), ldx21, work(ilarf) )
332 CALL drot( q-i+1, x11(i,i), ldx11, x21(i,i), ldx21, s, -c )
333 CALL dlarfgp( q-i+1, x21(i,i), x21(i,i+1), ldx21, tauq1(i) )
336 CALL dlarf(
'R', p-i, q-i+1, x21(i,i), ldx21, tauq1(i),
337 $ x11(i+1,i), ldx11, work(ilarf) )
338 CALL dlarf(
'R', m-p-i, q-i+1, x21(i,i), ldx21, tauq1(i),
339 $ x21(i+1,i), ldx21, work(ilarf) )
340 IF( i .LT. m-q )
THEN
341 s = sqrt( dnrm2( p-i, x11(i+1,i), 1 )**2
342 $ + dnrm2( m-p-i, x21(i+1,i), 1 )**2 )
343 phi(i) = atan2( s, c )
351 CALL dlarfgp( q-i+1, x11(i,i), x11(i,i+1), ldx11, tauq1(i) )
353 CALL dlarf(
'R', p-i, q-i+1, x11(i,i), ldx11, tauq1(i),
354 $ x11(i+1,i), ldx11, work(ilarf) )
355 CALL dlarf(
'R', q-p, q-i+1, x11(i,i), ldx11, tauq1(i),
356 $ x21(m-q+1,i), ldx21, work(ilarf) )
362 CALL dlarfgp( q-i+1, x21(m-q+i-p,i), x21(m-q+i-p,i+1), ldx21,
365 CALL dlarf(
'R', q-i, q-i+1, x21(m-q+i-p,i), ldx21, tauq1(i),
366 $ x21(m-q+i-p+1,i), ldx21, work(ilarf) )
subroutine xerbla(srname, info)
subroutine dlarf(side, m, n, v, incv, tau, c, ldc, work)
DLARF applies an elementary reflector to a general rectangular matrix.
subroutine dlarfgp(n, alpha, x, incx, tau)
DLARFGP generates an elementary reflector (Householder matrix) with non-negative beta.
subroutine drot(n, dx, incx, dy, incy, c, s)
DROT
subroutine dscal(n, da, dx, incx)
DSCAL
subroutine dorbdb4(m, p, q, x11, ldx11, x21, ldx21, theta, phi, taup1, taup2, tauq1, phantom, work, lwork, info)
DORBDB4
subroutine dorbdb5(m1, m2, n, x1, incx1, x2, incx2, q1, ldq1, q2, ldq2, work, lwork, info)
DORBDB5