261 SUBROUTINE zlalsa( ICOMPQ, SMLSIZ, N, NRHS, B, LDB, BX, LDBX,
263 $ LDU, VT, K, DIFL, DIFR, Z, POLES, GIVPTR,
264 $ GIVCOL, LDGCOL, PERM, GIVNUM, C, S, RWORK,
272 INTEGER ICOMPQ, INFO, LDB, LDBX, LDGCOL, LDU, N, NRHS,
276 INTEGER GIVCOL( LDGCOL, * ), GIVPTR( * ), IWORK( * ),
277 $ K( * ), PERM( LDGCOL, * )
278 DOUBLE PRECISION C( * ), DIFL( LDU, * ), DIFR( LDU, * ),
279 $ GIVNUM( LDU, * ), POLES( LDU, * ), RWORK( * ),
280 $ s( * ), u( ldu, * ), vt( ldu, * ), z( ldu, * )
281 COMPLEX*16 B( LDB, * ), BX( LDBX, * )
287 DOUBLE PRECISION ZERO, ONE
288 PARAMETER ( ZERO = 0.0d0, one = 1.0d0 )
291 INTEGER I, I1, IC, IM1, INODE, J, JCOL, JIMAG, JREAL,
292 $ jrow, lf, ll, lvl, lvl2, nd, ndb1, ndiml,
293 $ ndimr, nl, nlf, nlp1, nlvl, nr, nrf, nrp1, sqre
300 INTRINSIC dble, dcmplx, dimag
308 IF( ( icompq.LT.0 ) .OR. ( icompq.GT.1 ) )
THEN
310 ELSE IF( smlsiz.LT.3 )
THEN
312 ELSE IF( n.LT.smlsiz )
THEN
314 ELSE IF( nrhs.LT.1 )
THEN
316 ELSE IF( ldb.LT.n )
THEN
318 ELSE IF( ldbx.LT.n )
THEN
320 ELSE IF( ldu.LT.n )
THEN
322 ELSE IF( ldgcol.LT.n )
THEN
326 CALL xerbla(
'ZLALSA', -info )
336 CALL dlasdt( n, nlvl, nd, iwork( inode ), iwork( ndiml ),
337 $ iwork( ndimr ), smlsiz )
342 IF( icompq.EQ.1 )
THEN
361 ic = iwork( inode+i1 )
362 nl = iwork( ndiml+i1 )
363 nr = iwork( ndimr+i1 )
375 DO 10 jrow = nlf, nlf + nl - 1
377 rwork( j ) = dble( b( jrow, jcol ) )
380 CALL dgemm(
'T',
'N', nl, nrhs, nl, one, u( nlf, 1 ), ldu,
381 $ rwork( 1+nl*nrhs*2 ), nl, zero, rwork( 1 ), nl )
384 DO 30 jrow = nlf, nlf + nl - 1
386 rwork( j ) = dimag( b( jrow, jcol ) )
389 CALL dgemm(
'T',
'N', nl, nrhs, nl, one, u( nlf, 1 ), ldu,
390 $ rwork( 1+nl*nrhs*2 ), nl, zero, rwork( 1+nl*nrhs ),
395 DO 50 jrow = nlf, nlf + nl - 1
398 bx( jrow, jcol ) = dcmplx( rwork( jreal ),
411 DO 70 jrow = nrf, nrf + nr - 1
413 rwork( j ) = dble( b( jrow, jcol ) )
416 CALL dgemm(
'T',
'N', nr, nrhs, nr, one, u( nrf, 1 ), ldu,
417 $ rwork( 1+nr*nrhs*2 ), nr, zero, rwork( 1 ), nr )
419 DO 100 jcol = 1, nrhs
420 DO 90 jrow = nrf, nrf + nr - 1
422 rwork( j ) = dimag( b( jrow, jcol ) )
425 CALL dgemm(
'T',
'N', nr, nrhs, nr, one, u( nrf, 1 ), ldu,
426 $ rwork( 1+nr*nrhs*2 ), nr, zero, rwork( 1+nr*nrhs ),
430 DO 120 jcol = 1, nrhs
431 DO 110 jrow = nrf, nrf + nr - 1
434 bx( jrow, jcol ) = dcmplx( rwork( jreal ),
445 ic = iwork( inode+i-1 )
446 CALL zcopy( nrhs, b( ic, 1 ), ldb, bx( ic, 1 ), ldbx )
455 DO 160 lvl = nlvl, 1, -1
470 ic = iwork( inode+im1 )
471 nl = iwork( ndiml+im1 )
472 nr = iwork( ndimr+im1 )
476 CALL zlals0( icompq, nl, nr, sqre, nrhs, bx( nlf, 1 ),
478 $ b( nlf, 1 ), ldb, perm( nlf, lvl ),
479 $ givptr( j ), givcol( nlf, lvl2 ), ldgcol,
480 $ givnum( nlf, lvl2 ), ldu, poles( nlf, lvl2 ),
481 $ difl( nlf, lvl ), difr( nlf, lvl2 ),
482 $ z( nlf, lvl ), k( j ), c( j ), s( j ), rwork,
509 DO 180 i = ll, lf, -1
511 ic = iwork( inode+im1 )
512 nl = iwork( ndiml+im1 )
513 nr = iwork( ndimr+im1 )
522 CALL zlals0( icompq, nl, nr, sqre, nrhs, b( nlf, 1 ),
524 $ bx( nlf, 1 ), ldbx, perm( nlf, lvl ),
525 $ givptr( j ), givcol( nlf, lvl2 ), ldgcol,
526 $ givnum( nlf, lvl2 ), ldu, poles( nlf, lvl2 ),
527 $ difl( nlf, lvl ), difr( nlf, lvl2 ),
528 $ z( nlf, lvl ), k( j ), c( j ), s( j ), rwork,
540 ic = iwork( inode+i1 )
541 nl = iwork( ndiml+i1 )
542 nr = iwork( ndimr+i1 )
559 DO 210 jcol = 1, nrhs
560 DO 200 jrow = nlf, nlf + nlp1 - 1
562 rwork( j ) = dble( b( jrow, jcol ) )
565 CALL dgemm(
'T',
'N', nlp1, nrhs, nlp1, one, vt( nlf, 1 ),
567 $ rwork( 1+nlp1*nrhs*2 ), nlp1, zero, rwork( 1 ),
570 DO 230 jcol = 1, nrhs
571 DO 220 jrow = nlf, nlf + nlp1 - 1
573 rwork( j ) = dimag( b( jrow, jcol ) )
576 CALL dgemm(
'T',
'N', nlp1, nrhs, nlp1, one, vt( nlf, 1 ),
578 $ rwork( 1+nlp1*nrhs*2 ), nlp1, zero,
579 $ rwork( 1+nlp1*nrhs ), nlp1 )
582 DO 250 jcol = 1, nrhs
583 DO 240 jrow = nlf, nlf + nlp1 - 1
586 bx( jrow, jcol ) = dcmplx( rwork( jreal ),
598 DO 270 jcol = 1, nrhs
599 DO 260 jrow = nrf, nrf + nrp1 - 1
601 rwork( j ) = dble( b( jrow, jcol ) )
604 CALL dgemm(
'T',
'N', nrp1, nrhs, nrp1, one, vt( nrf, 1 ),
606 $ rwork( 1+nrp1*nrhs*2 ), nrp1, zero, rwork( 1 ),
609 DO 290 jcol = 1, nrhs
610 DO 280 jrow = nrf, nrf + nrp1 - 1
612 rwork( j ) = dimag( b( jrow, jcol ) )
615 CALL dgemm(
'T',
'N', nrp1, nrhs, nrp1, one, vt( nrf, 1 ),
617 $ rwork( 1+nrp1*nrhs*2 ), nrp1, zero,
618 $ rwork( 1+nrp1*nrhs ), nrp1 )
621 DO 310 jcol = 1, nrhs
622 DO 300 jrow = nrf, nrf + nrp1 - 1
625 bx( jrow, jcol ) = dcmplx( rwork( jreal ),