269 SUBROUTINE zlals0( ICOMPQ, NL, NR, SQRE, NRHS, B, LDB, BX, LDBX,
270 $ perm, givptr, givcol, ldgcol, givnum, ldgnum,
271 $ poles, difl, difr, z, k, c, s, rwork, info )
279 INTEGER GIVPTR, ICOMPQ, INFO, K, LDB, LDBX, LDGCOL,
280 $ ldgnum, nl, nr, nrhs, sqre
281 DOUBLE PRECISION C, S
284 INTEGER GIVCOL( ldgcol, * ), PERM( * )
285 DOUBLE PRECISION DIFL( * ), DIFR( ldgnum, * ),
286 $ givnum( ldgnum, * ), poles( ldgnum, * ),
288 COMPLEX*16 B( ldb, * ), BX( ldbx, * )
294 DOUBLE PRECISION ONE, ZERO, NEGONE
295 parameter ( one = 1.0d0, zero = 0.0d0, negone = -1.0d0 )
298 INTEGER I, J, JCOL, JROW, M, N, NLP1
299 DOUBLE PRECISION DIFLJ, DIFRJ, DJ, DSIGJ, DSIGJP, TEMP
306 DOUBLE PRECISION DLAMC3, DNRM2
307 EXTERNAL dlamc3, dnrm2
310 INTRINSIC dble, dcmplx, dimag, max
319 IF( ( icompq.LT.0 ) .OR. ( icompq.GT.1 ) )
THEN
321 ELSE IF( nl.LT.1 )
THEN
323 ELSE IF( nr.LT.1 )
THEN
325 ELSE IF( ( sqre.LT.0 ) .OR. ( sqre.GT.1 ) )
THEN
327 ELSE IF( nrhs.LT.1 )
THEN
329 ELSE IF( ldb.LT.n )
THEN
331 ELSE IF( ldbx.LT.n )
THEN
333 ELSE IF( givptr.LT.0 )
THEN
335 ELSE IF( ldgcol.LT.n )
THEN
337 ELSE IF( ldgnum.LT.n )
THEN
339 ELSE IF( k.LT.1 )
THEN
343 CALL xerbla(
'ZLALS0', -info )
350 IF( icompq.EQ.0 )
THEN
357 CALL zdrot( nrhs, b( givcol( i, 2 ), 1 ), ldb,
358 $ b( givcol( i, 1 ), 1 ), ldb, givnum( i, 2 ),
364 CALL zcopy( nrhs, b( nlp1, 1 ), ldb, bx( 1, 1 ), ldbx )
366 CALL zcopy( nrhs, b( perm( i ), 1 ), ldb, bx( i, 1 ), ldbx )
373 CALL zcopy( nrhs, bx, ldbx, b, ldb )
374 IF( z( 1 ).LT.zero )
THEN
375 CALL zdscal( nrhs, negone, b, ldb )
381 dsigj = -poles( j, 2 )
383 difrj = -difr( j, 1 )
384 dsigjp = -poles( j+1, 2 )
386 IF( ( z( j ).EQ.zero ) .OR. ( poles( j, 2 ).EQ.zero ) )
390 rwork( j ) = -poles( j, 2 )*z( j ) / diflj /
391 $ ( poles( j, 2 )+dj )
394 IF( ( z( i ).EQ.zero ) .OR.
395 $ ( poles( i, 2 ).EQ.zero ) )
THEN
398 rwork( i ) = poles( i, 2 )*z( i ) /
399 $ ( dlamc3( poles( i, 2 ), dsigj )-
400 $ diflj ) / ( poles( i, 2 )+dj )
404 IF( ( z( i ).EQ.zero ) .OR.
405 $ ( poles( i, 2 ).EQ.zero ) )
THEN
408 rwork( i ) = poles( i, 2 )*z( i ) /
409 $ ( dlamc3( poles( i, 2 ), dsigjp )+
410 $ difrj ) / ( poles( i, 2 )+dj )
414 temp = dnrm2( k, rwork, 1 )
426 rwork( i ) = dble( bx( jrow, jcol ) )
429 CALL dgemv(
'T', k, nrhs, one, rwork( 1+k+nrhs*2 ), k,
430 $ rwork( 1 ), 1, zero, rwork( 1+k ), 1 )
435 rwork( i ) = dimag( bx( jrow, jcol ) )
438 CALL dgemv(
'T', k, nrhs, one, rwork( 1+k+nrhs*2 ), k,
439 $ rwork( 1 ), 1, zero, rwork( 1+k+nrhs ), 1 )
441 b( j, jcol ) = dcmplx( rwork( jcol+k ),
442 $ rwork( jcol+k+nrhs ) )
444 CALL zlascl(
'G', 0, 0, temp, one, 1, nrhs, b( j, 1 ),
451 IF( k.LT.max( m, n ) )
452 $
CALL zlacpy(
'A', n-k, nrhs, bx( k+1, 1 ), ldbx,
462 CALL zcopy( nrhs, b, ldb, bx, ldbx )
465 dsigj = poles( j, 2 )
466 IF( z( j ).EQ.zero )
THEN
469 rwork( j ) = -z( j ) / difl( j ) /
470 $ ( dsigj+poles( j, 1 ) ) / difr( j, 2 )
473 IF( z( j ).EQ.zero )
THEN
476 rwork( i ) = z( j ) / ( dlamc3( dsigj, -poles( i+1,
477 $ 2 ) )-difr( i, 1 ) ) /
478 $ ( dsigj+poles( i, 1 ) ) / difr( i, 2 )
482 IF( z( j ).EQ.zero )
THEN
485 rwork( i ) = z( j ) / ( dlamc3( dsigj, -poles( i,
486 $ 2 ) )-difl( i ) ) /
487 $ ( dsigj+poles( i, 1 ) ) / difr( i, 2 )
498 DO 140 jcol = 1, nrhs
501 rwork( i ) = dble( b( jrow, jcol ) )
504 CALL dgemv(
'T', k, nrhs, one, rwork( 1+k+nrhs*2 ), k,
505 $ rwork( 1 ), 1, zero, rwork( 1+k ), 1 )
507 DO 160 jcol = 1, nrhs
510 rwork( i ) = dimag( b( jrow, jcol ) )
513 CALL dgemv(
'T', k, nrhs, one, rwork( 1+k+nrhs*2 ), k,
514 $ rwork( 1 ), 1, zero, rwork( 1+k+nrhs ), 1 )
515 DO 170 jcol = 1, nrhs
516 bx( j, jcol ) = dcmplx( rwork( jcol+k ),
517 $ rwork( jcol+k+nrhs ) )
526 CALL zcopy( nrhs, b( m, 1 ), ldb, bx( m, 1 ), ldbx )
527 CALL zdrot( nrhs, bx( 1, 1 ), ldbx, bx( m, 1 ), ldbx, c, s )
529 IF( k.LT.max( m, n ) )
530 $
CALL zlacpy(
'A', n-k, nrhs, b( k+1, 1 ), ldb, bx( k+1, 1 ),
535 CALL zcopy( nrhs, bx( 1, 1 ), ldbx, b( nlp1, 1 ), ldb )
537 CALL zcopy( nrhs, bx( m, 1 ), ldbx, b( m, 1 ), ldb )
540 CALL zcopy( nrhs, bx( i, 1 ), ldbx, b( perm( i ), 1 ), ldb )
545 DO 200 i = givptr, 1, -1
546 CALL zdrot( nrhs, b( givcol( i, 2 ), 1 ), ldb,
547 $ b( givcol( i, 1 ), 1 ), ldb, givnum( i, 2 ),
subroutine zlacpy(UPLO, M, N, A, LDA, B, LDB)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine zcopy(N, ZX, INCX, ZY, INCY)
ZCOPY
subroutine dgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
DGEMV
subroutine xerbla(SRNAME, INFO)
XERBLA
subroutine zdrot(N, CX, INCX, CY, INCY, C, S)
ZDROT
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 zdscal(N, DA, ZX, INCX)
ZDSCAL
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.