211 SUBROUTINE sorbdb4( M, P, Q, X11, LDX11, X21, LDX21, THETA, PHI,
212 $ TAUP1, TAUP2, TAUQ1, PHANTOM, WORK, LWORK,
220 INTEGER INFO, LWORK, M, P, Q, LDX11, LDX21
223 REAL PHI(*), THETA(*)
224 REAL PHANTOM(*), TAUP1(*), TAUP2(*), TAUQ1(*),
225 $ work(*), x11(ldx11,*), x21(ldx21,*)
231 REAL NEGONE, ONE, ZERO
232 PARAMETER ( NEGONE = -1.0e0, one = 1.0e0, zero = 0.0e0 )
236 INTEGER CHILDINFO, I, ILARF, IORBDB5, J, LLARF,
237 $ lorbdb5, lworkmin, lworkopt
248 INTRINSIC atan2, cos, max, sin, sqrt
255 lquery = lwork .EQ. -1
259 ELSE IF( p .LT. m-q .OR. m-p .LT. m-q )
THEN
261 ELSE IF( q .LT. m-q .OR. q .GT. m )
THEN
263 ELSE IF( ldx11 .LT. max( 1, p ) )
THEN
265 ELSE IF( ldx21 .LT. max( 1, m-p ) )
THEN
271 IF( info .EQ. 0 )
THEN
273 llarf = max( q-1, p-1, m-p-1 )
276 lworkopt = ilarf + llarf - 1
277 lworkopt = max( lworkopt, iorbdb5 + lorbdb5 - 1 )
280 IF( lwork .LT. lworkmin .AND. .NOT.lquery )
THEN
284 IF( info .NE. 0 )
THEN
285 CALL xerbla(
'SORBDB4', -info )
287 ELSE IF( lquery )
THEN
299 CALL sorbdb5( p, m-p, q, phantom(1), 1, phantom(p+1), 1,
300 $ x11, ldx11, x21, ldx21, work(iorbdb5),
301 $ lorbdb5, childinfo )
302 CALL sscal( p, negone, phantom(1), 1 )
303 CALL slarfgp( p, phantom(1), phantom(2), 1, taup1(1) )
304 CALL slarfgp( m-p, phantom(p+1), phantom(p+2), 1, taup2(1) )
305 theta(i) = atan2( phantom(1), phantom(p+1) )
310 CALL slarf(
'L', p, q, phantom(1), 1, taup1(1), x11, ldx11,
312 CALL slarf(
'L', m-p, q, phantom(p+1), 1, taup2(1), x21,
313 $ ldx21, work(ilarf) )
315 CALL sorbdb5( p-i+1, m-p-i+1, q-i+1, x11(i,i-1), 1,
316 $ x21(i,i-1), 1, x11(i,i), ldx11, x21(i,i),
317 $ ldx21, work(iorbdb5), lorbdb5, childinfo )
318 CALL sscal( p-i+1, negone, x11(i,i-1), 1 )
319 CALL slarfgp( p-i+1, x11(i,i-1), x11(i+1,i-1), 1, taup1(i) )
320 CALL slarfgp( m-p-i+1, x21(i,i-1), x21(i+1,i-1), 1,
322 theta(i) = atan2( x11(i,i-1), x21(i,i-1) )
327 CALL slarf(
'L', p-i+1, q-i+1, x11(i,i-1), 1, taup1(i),
328 $ x11(i,i), ldx11, work(ilarf) )
329 CALL slarf(
'L', m-p-i+1, q-i+1, x21(i,i-1), 1, taup2(i),
330 $ x21(i,i), ldx21, work(ilarf) )
333 CALL srot( q-i+1, x11(i,i), ldx11, x21(i,i), ldx21, s, -c )
334 CALL slarfgp( q-i+1, x21(i,i), x21(i,i+1), ldx21, tauq1(i) )
337 CALL slarf(
'R', p-i, q-i+1, x21(i,i), ldx21, tauq1(i),
338 $ x11(i+1,i), ldx11, work(ilarf) )
339 CALL slarf(
'R', m-p-i, q-i+1, x21(i,i), ldx21, tauq1(i),
340 $ x21(i+1,i), ldx21, work(ilarf) )
341 IF( i .LT. m-q )
THEN
342 s = sqrt( snrm2( p-i, x11(i+1,i), 1 )**2
343 $ + snrm2( m-p-i, x21(i+1,i), 1 )**2 )
344 phi(i) = atan2( s, c )
352 CALL slarfgp( q-i+1, x11(i,i), x11(i,i+1), ldx11, tauq1(i) )
354 CALL slarf(
'R', p-i, q-i+1, x11(i,i), ldx11, tauq1(i),
355 $ x11(i+1,i), ldx11, work(ilarf) )
356 CALL slarf(
'R', q-p, q-i+1, x11(i,i), ldx11, tauq1(i),
357 $ x21(m-q+1,i), ldx21, work(ilarf) )
363 CALL slarfgp( q-i+1, x21(m-q+i-p,i), x21(m-q+i-p,i+1), ldx21,
366 CALL slarf(
'R', q-i, q-i+1, x21(m-q+i-p,i), ldx21, tauq1(i),
367 $ x21(m-q+i-p+1,i), ldx21, work(ilarf) )
subroutine xerbla(srname, info)
subroutine slarf(side, m, n, v, incv, tau, c, ldc, work)
SLARF applies an elementary reflector to a general rectangular matrix.
subroutine slarfgp(n, alpha, x, incx, tau)
SLARFGP generates an elementary reflector (Householder matrix) with non-negative beta.
subroutine srot(n, sx, incx, sy, incy, c, s)
SROT
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine sorbdb4(m, p, q, x11, ldx11, x21, ldx21, theta, phi, taup1, taup2, tauq1, phantom, work, lwork, info)
SORBDB4
subroutine sorbdb5(m1, m2, n, x1, incx1, x2, incx2, q1, ldq1, q2, ldq2, work, lwork, info)
SORBDB5