267 SUBROUTINE zlals0( ICOMPQ, NL, NR, SQRE, NRHS, B, LDB, BX, LDBX,
268 $ PERM, GIVPTR, GIVCOL, LDGCOL, GIVNUM, LDGNUM,
269 $ POLES, DIFL, DIFR, Z, K, C, S, RWORK, INFO )
276 INTEGER GIVPTR, ICOMPQ, INFO, K, LDB, LDBX, LDGCOL,
277 $ LDGNUM, NL, NR, NRHS, SQRE
278 DOUBLE PRECISION C, S
281 INTEGER GIVCOL( LDGCOL, * ), PERM( * )
282 DOUBLE PRECISION DIFL( * ), DIFR( LDGNUM, * ),
283 $ givnum( ldgnum, * ), poles( ldgnum, * ),
285 COMPLEX*16 B( LDB, * ), BX( LDBX, * )
291 DOUBLE PRECISION ONE, ZERO, NEGONE
292 PARAMETER ( ONE = 1.0d0, zero = 0.0d0, negone = -1.0d0 )
295 INTEGER I, J, JCOL, JROW, M, N, NLP1
296 DOUBLE PRECISION DIFLJ, DIFRJ, DJ, DSIGJ, DSIGJP, TEMP
303 DOUBLE PRECISION DLAMC3, DNRM2
304 EXTERNAL DLAMC3, DNRM2
307 INTRINSIC dble, dcmplx, dimag, max
316 IF( ( icompq.LT.0 ) .OR. ( icompq.GT.1 ) )
THEN
318 ELSE IF( nl.LT.1 )
THEN
320 ELSE IF( nr.LT.1 )
THEN
322 ELSE IF( ( sqre.LT.0 ) .OR. ( sqre.GT.1 ) )
THEN
324 ELSE IF( nrhs.LT.1 )
THEN
326 ELSE IF( ldb.LT.n )
THEN
328 ELSE IF( ldbx.LT.n )
THEN
330 ELSE IF( givptr.LT.0 )
THEN
332 ELSE IF( ldgcol.LT.n )
THEN
334 ELSE IF( ldgnum.LT.n )
THEN
336 ELSE IF( k.LT.1 )
THEN
340 CALL xerbla(
'ZLALS0', -info )
347 IF( icompq.EQ.0 )
THEN
354 CALL zdrot( nrhs, b( givcol( i, 2 ), 1 ), ldb,
355 $ b( givcol( i, 1 ), 1 ), ldb, givnum( i, 2 ),
361 CALL zcopy( nrhs, b( nlp1, 1 ), ldb, bx( 1, 1 ), ldbx )
363 CALL zcopy( nrhs, b( perm( i ), 1 ), ldb, bx( i, 1 ), ldbx )
370 CALL zcopy( nrhs, bx, ldbx, b, ldb )
371 IF( z( 1 ).LT.zero )
THEN
372 CALL zdscal( nrhs, negone, b, ldb )
378 dsigj = -poles( j, 2 )
380 difrj = -difr( j, 1 )
381 dsigjp = -poles( j+1, 2 )
383 IF( ( z( j ).EQ.zero ) .OR. ( poles( j, 2 ).EQ.zero ) )
387 rwork( j ) = -poles( j, 2 )*z( j ) / diflj /
388 $ ( poles( j, 2 )+dj )
391 IF( ( z( i ).EQ.zero ) .OR.
392 $ ( poles( i, 2 ).EQ.zero ) )
THEN
400 rwork( i ) = poles( i, 2 )*z( i ) /
401 $ ( dlamc3( poles( i, 2 ), dsigj )-
402 $ diflj ) / ( poles( i, 2 )+dj )
406 IF( ( z( i ).EQ.zero ) .OR.
407 $ ( poles( i, 2 ).EQ.zero ) )
THEN
410 rwork( i ) = poles( i, 2 )*z( i ) /
411 $ ( dlamc3( poles( i, 2 ), dsigjp )+
412 $ difrj ) / ( poles( i, 2 )+dj )
416 temp = dnrm2( k, rwork, 1 )
428 rwork( i ) = dble( bx( jrow, jcol ) )
431 CALL dgemv(
'T', k, nrhs, one, rwork( 1+k+nrhs*2 ), k,
432 $ rwork( 1 ), 1, zero, rwork( 1+k ), 1 )
437 rwork( i ) = dimag( bx( jrow, jcol ) )
440 CALL dgemv(
'T', k, nrhs, one, rwork( 1+k+nrhs*2 ), k,
441 $ rwork( 1 ), 1, zero, rwork( 1+k+nrhs ), 1 )
443 b( j, jcol ) = dcmplx( rwork( jcol+k ),
444 $ rwork( jcol+k+nrhs ) )
446 CALL zlascl(
'G', 0, 0, temp, one, 1, nrhs, b( j, 1 ),
453 IF( k.LT.max( m, n ) )
454 $
CALL zlacpy(
'A', n-k, nrhs, bx( k+1, 1 ), ldbx,
464 CALL zcopy( nrhs, b, ldb, bx, ldbx )
467 dsigj = poles( j, 2 )
468 IF( z( j ).EQ.zero )
THEN
471 rwork( j ) = -z( j ) / difl( j ) /
472 $ ( dsigj+poles( j, 1 ) ) / difr( j, 2 )
475 IF( z( j ).EQ.zero )
THEN
483 rwork( i ) = z( j ) / ( dlamc3( dsigj, -poles( i+1,
484 $ 2 ) )-difr( i, 1 ) ) /
485 $ ( dsigj+poles( i, 1 ) ) / difr( i, 2 )
489 IF( z( j ).EQ.zero )
THEN
492 rwork( i ) = z( j ) / ( dlamc3( dsigj, -poles( i,
493 $ 2 ) )-difl( i ) ) /
494 $ ( dsigj+poles( i, 1 ) ) / difr( i, 2 )
505 DO 140 jcol = 1, nrhs
508 rwork( i ) = dble( b( jrow, jcol ) )
511 CALL dgemv(
'T', k, nrhs, one, rwork( 1+k+nrhs*2 ), k,
512 $ rwork( 1 ), 1, zero, rwork( 1+k ), 1 )
514 DO 160 jcol = 1, nrhs
517 rwork( i ) = dimag( b( jrow, jcol ) )
520 CALL dgemv(
'T', k, nrhs, one, rwork( 1+k+nrhs*2 ), k,
521 $ rwork( 1 ), 1, zero, rwork( 1+k+nrhs ), 1 )
522 DO 170 jcol = 1, nrhs
523 bx( j, jcol ) = dcmplx( rwork( jcol+k ),
524 $ rwork( jcol+k+nrhs ) )
533 CALL zcopy( nrhs, b( m, 1 ), ldb, bx( m, 1 ), ldbx )
534 CALL zdrot( nrhs, bx( 1, 1 ), ldbx, bx( m, 1 ), ldbx, c, s )
536 IF( k.LT.max( m, n ) )
537 $
CALL zlacpy(
'A', n-k, nrhs, b( k+1, 1 ), ldb, bx( k+1, 1 ),
542 CALL zcopy( nrhs, bx( 1, 1 ), ldbx, b( nlp1, 1 ), ldb )
544 CALL zcopy( nrhs, bx( m, 1 ), ldbx, b( m, 1 ), ldb )
547 CALL zcopy( nrhs, bx( i, 1 ), ldbx, b( perm( i ), 1 ), ldb )
552 DO 200 i = givptr, 1, -1
553 CALL zdrot( nrhs, b( givcol( i, 2 ), 1 ), ldb,
554 $ b( givcol( i, 1 ), 1 ), ldb, givnum( i, 2 ),
subroutine xerbla(srname, info)
subroutine zcopy(n, zx, incx, zy, incy)
ZCOPY
subroutine dgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
DGEMV
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine zlals0(icompq, nl, nr, sqre, nrhs, b, ldb, bx, ldbx, perm, givptr, givcol, ldgcol, givnum, ldgnum, poles, difl, difr, z, k, c, s, rwork, info)
ZLALS0 applies back multiplying factors in solving the least squares problem using divide and conquer...
subroutine zlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
ZLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine zdrot(n, zx, incx, zy, incy, c, s)
ZDROT
subroutine zdscal(n, da, zx, incx)
ZDSCAL