198 SUBROUTINE cunbdb1( M, P, Q, X11, LDX11, X21, LDX21, THETA,
200 $ TAUP1, TAUP2, TAUQ1, WORK, LWORK, INFO )
207 INTEGER INFO, LWORK, M, P, Q, LDX11, LDX21
210 REAL PHI(*), THETA(*)
211 COMPLEX TAUP1(*), TAUP2(*), TAUQ1(*), WORK(*),
212 $ x11(ldx11,*), x21(ldx21,*)
219 INTEGER CHILDINFO, I, ILARF, IORBDB5, LLARF, LORBDB5,
229 REAL SCNRM2, SROUNDUP_LWORK
230 EXTERNAL SCNRM2, SROUNDUP_LWORK
233 INTRINSIC atan2, cos, max, sin, sqrt
240 lquery = lwork .EQ. -1
244 ELSE IF( p .LT. q .OR. m-p .LT. q )
THEN
246 ELSE IF( q .LT. 0 .OR. m-q .LT. q )
THEN
248 ELSE IF( ldx11 .LT. max( 1, p ) )
THEN
250 ELSE IF( ldx21 .LT. max( 1, m-p ) )
THEN
256 IF( info .EQ. 0 )
THEN
258 llarf = max( p-1, m-p-1, q-1 )
261 lworkopt = max( ilarf+llarf-1, iorbdb5+lorbdb5-1 )
263 work(1) = sroundup_lwork(lworkopt)
264 IF( lwork .LT. lworkmin .AND. .NOT.lquery )
THEN
268 IF( info .NE. 0 )
THEN
269 CALL xerbla(
'CUNBDB1', -info )
271 ELSE IF( lquery )
THEN
279 CALL clarfgp( p-i+1, x11(i,i), x11(i+1,i), 1, taup1(i) )
280 CALL clarfgp( m-p-i+1, x21(i,i), x21(i+1,i), 1, taup2(i) )
281 theta(i) = atan2( real( x21(i,i) ), real( x11(i,i) ) )
284 CALL clarf1f(
'L', p-i+1, q-i, x11(i,i), 1, conjg(taup1(i)),
285 $ x11(i,i+1), ldx11, work(ilarf) )
286 CALL clarf1f(
'L', m-p-i+1, q-i, x21(i,i), 1,
287 $ conjg(taup2(i)), x21(i,i+1), ldx21,
291 CALL csrot( q-i, x11(i,i+1), ldx11, x21(i,i+1), ldx21, c,
293 CALL clacgv( q-i, x21(i,i+1), ldx21 )
294 CALL clarfgp( q-i, x21(i,i+1), x21(i,i+2), ldx21,
296 s = real( x21(i,i+1) )
297 CALL clarf1f(
'R', p-i, q-i, x21(i,i+1), ldx21, tauq1(i),
298 $ x11(i+1,i+1), ldx11, work(ilarf) )
299 CALL clarf1f(
'R', m-p-i, q-i, x21(i,i+1), ldx21,
300 $ tauq1(i), x21(i+1,i+1), ldx21,
302 CALL clacgv( q-i, x21(i,i+1), ldx21 )
303 c = sqrt( scnrm2( p-i, x11(i+1,i+1), 1 )**2
304 $ + scnrm2( m-p-i, x21(i+1,i+1), 1 )**2 )
305 phi(i) = atan2( s, c )
306 CALL cunbdb5( p-i, m-p-i, q-i-1, x11(i+1,i+1), 1,
307 $ x21(i+1,i+1), 1, x11(i+1,i+2), ldx11,
308 $ x21(i+1,i+2), ldx21, work(iorbdb5), lorbdb5,