200 SUBROUTINE cunbdb2( M, P, Q, X11, LDX11, X21, LDX21, THETA, PHI,
201 $ TAUP1, TAUP2, TAUQ1, WORK, LWORK, INFO )
208 INTEGER INFO, LWORK, M, P, Q, LDX11, LDX21
211 REAL PHI(*), THETA(*)
212 COMPLEX TAUP1(*), TAUP2(*), TAUQ1(*), WORK(*),
213 $ x11(ldx11,*), x21(ldx21,*)
220 parameter( negone = (-1.0e0,0.0e0),
221 $ one = (1.0e0,0.0e0) )
225 INTEGER CHILDINFO, I, ILARF, IORBDB5, LLARF, LORBDB5,
234 REAL SCNRM2, SROUNDUP_LWORK
235 EXTERNAL scnrm2, sroundup_lwork
238 INTRINSIC atan2, cos, max, sin, sqrt
245 lquery = lwork .EQ. -1
249 ELSE IF( p .LT. 0 .OR. p .GT. m-p )
THEN
251 ELSE IF( q .LT. 0 .OR. q .LT. p .OR. m-q .LT. p )
THEN
253 ELSE IF( ldx11 .LT. max( 1, p ) )
THEN
255 ELSE IF( ldx21 .LT. max( 1, m-p ) )
THEN
261 IF( info .EQ. 0 )
THEN
263 llarf = max( p-1, m-p, q-1 )
266 lworkopt = max( ilarf+llarf-1, iorbdb5+lorbdb5-1 )
268 work(1) = sroundup_lwork(lworkopt)
269 IF( lwork .LT. lworkmin .AND. .NOT.lquery )
THEN
273 IF( info .NE. 0 )
THEN
274 CALL xerbla(
'CUNBDB2', -info )
276 ELSE IF( lquery )
THEN
285 CALL csrot( q-i+1, x11(i,i), ldx11, x21(i-1,i), ldx21, c,
288 CALL clacgv( q-i+1, x11(i,i), ldx11 )
289 CALL clarfgp( q-i+1, x11(i,i), x11(i,i+1), ldx11, tauq1(i) )
292 CALL clarf(
'R', p-i, q-i+1, x11(i,i), ldx11, tauq1(i),
293 $ x11(i+1,i), ldx11, work(ilarf) )
294 CALL clarf(
'R', m-p-i+1, q-i+1, x11(i,i), ldx11, tauq1(i),
295 $ x21(i,i), ldx21, work(ilarf) )
296 CALL clacgv( q-i+1, x11(i,i), ldx11 )
297 s = sqrt( scnrm2( p-i, x11(i+1,i), 1 )**2
298 $ + scnrm2( m-p-i+1, x21(i,i), 1 )**2 )
299 theta(i) = atan2( s, c )
301 CALL cunbdb5( p-i, m-p-i+1, q-i, x11(i+1,i), 1, x21(i,i), 1,
302 $ x11(i+1,i+1), ldx11, x21(i,i+1), ldx21,
303 $ work(iorbdb5), lorbdb5, childinfo )
304 CALL cscal( p-i, negone, x11(i+1,i), 1 )
305 CALL clarfgp( m-p-i+1, x21(i,i), x21(i+1,i), 1, taup2(i) )
307 CALL clarfgp( p-i, x11(i+1,i), x11(i+2,i), 1, taup1(i) )
308 phi(i) = atan2( real( x11(i+1,i) ), real( x21(i,i) ) )
312 CALL clarf(
'L', p-i, q-i, x11(i+1,i), 1, conjg(taup1(i)),
313 $ x11(i+1,i+1), ldx11, work(ilarf) )
316 CALL clarf(
'L', m-p-i+1, q-i, x21(i,i), 1, conjg(taup2(i)),
317 $ x21(i,i+1), ldx21, work(ilarf) )
324 CALL clarfgp( m-p-i+1, x21(i,i), x21(i+1,i), 1, taup2(i) )
326 CALL clarf(
'L', m-p-i+1, q-i, x21(i,i), 1, conjg(taup2(i)),
327 $ x21(i,i+1), ldx21, work(ilarf) )
subroutine xerbla(srname, info)
subroutine clacgv(n, x, incx)
CLACGV conjugates a complex vector.
subroutine clarf(side, m, n, v, incv, tau, c, ldc, work)
CLARF applies an elementary reflector to a general rectangular matrix.
subroutine clarfgp(n, alpha, x, incx, tau)
CLARFGP generates an elementary reflector (Householder matrix) with non-negative beta.
subroutine csrot(n, cx, incx, cy, incy, c, s)
CSROT
subroutine cscal(n, ca, cx, incx)
CSCAL
subroutine cunbdb2(m, p, q, x11, ldx11, x21, ldx21, theta, phi, taup1, taup2, tauq1, work, lwork, info)
CUNBDB2
subroutine cunbdb5(m1, m2, n, x1, incx1, x2, incx2, q1, ldq1, q2, ldq2, work, lwork, info)
CUNBDB5