265 SUBROUTINE dlals0( ICOMPQ, NL, NR, SQRE, NRHS, B, LDB, BX, LDBX,
266 $ PERM, GIVPTR, GIVCOL, LDGCOL, GIVNUM, LDGNUM,
267 $ POLES, DIFL, DIFR, Z, K, C, S, WORK, INFO )
274 INTEGER GIVPTR, ICOMPQ, INFO, K, LDB, LDBX, LDGCOL,
275 $ LDGNUM, NL, NR, NRHS, SQRE
276 DOUBLE PRECISION C, S
279 INTEGER GIVCOL( LDGCOL, * ), PERM( * )
280 DOUBLE PRECISION B( LDB, * ), BX( LDBX, * ), DIFL( * ),
281 $ difr( ldgnum, * ), givnum( ldgnum, * ),
282 $ poles( ldgnum, * ), work( * ), z( * )
288 DOUBLE PRECISION ONE, ZERO, NEGONE
289 PARAMETER ( ONE = 1.0d0, zero = 0.0d0, negone = -1.0d0 )
292 INTEGER I, J, M, N, NLP1
293 DOUBLE PRECISION DIFLJ, DIFRJ, DJ, DSIGJ, DSIGJP, TEMP
300 DOUBLE PRECISION DLAMC3, DNRM2
301 EXTERNAL DLAMC3, DNRM2
313 IF( ( icompq.LT.0 ) .OR. ( icompq.GT.1 ) )
THEN
315 ELSE IF( nl.LT.1 )
THEN
317 ELSE IF( nr.LT.1 )
THEN
319 ELSE IF( ( sqre.LT.0 ) .OR. ( sqre.GT.1 ) )
THEN
321 ELSE IF( nrhs.LT.1 )
THEN
323 ELSE IF( ldb.LT.n )
THEN
325 ELSE IF( ldbx.LT.n )
THEN
327 ELSE IF( givptr.LT.0 )
THEN
329 ELSE IF( ldgcol.LT.n )
THEN
331 ELSE IF( ldgnum.LT.n )
THEN
333 ELSE IF( k.LT.1 )
THEN
337 CALL xerbla(
'DLALS0', -info )
344 IF( icompq.EQ.0 )
THEN
351 CALL drot( nrhs, b( givcol( i, 2 ), 1 ), ldb,
352 $ b( givcol( i, 1 ), 1 ), ldb, givnum( i, 2 ),
358 CALL dcopy( nrhs, b( nlp1, 1 ), ldb, bx( 1, 1 ), ldbx )
360 CALL dcopy( nrhs, b( perm( i ), 1 ), ldb, bx( i, 1 ), ldbx )
367 CALL dcopy( nrhs, bx, ldbx, b, ldb )
368 IF( z( 1 ).LT.zero )
THEN
369 CALL dscal( nrhs, negone, b, ldb )
375 dsigj = -poles( j, 2 )
377 difrj = -difr( j, 1 )
378 dsigjp = -poles( j+1, 2 )
380 IF( ( z( j ).EQ.zero ) .OR. ( poles( j, 2 ).EQ.zero ) )
384 work( j ) = -poles( j, 2 )*z( j ) / diflj /
385 $ ( poles( j, 2 )+dj )
388 IF( ( z( i ).EQ.zero ) .OR.
389 $ ( poles( i, 2 ).EQ.zero ) )
THEN
397 work( i ) = poles( i, 2 )*z( i ) /
398 $ ( dlamc3( poles( i, 2 ), dsigj )-
399 $ diflj ) / ( poles( i, 2 )+dj )
403 IF( ( z( i ).EQ.zero ) .OR.
404 $ ( poles( i, 2 ).EQ.zero ) )
THEN
407 work( i ) = poles( i, 2 )*z( i ) /
408 $ ( dlamc3( poles( i, 2 ), dsigjp )+
409 $ difrj ) / ( poles( i, 2 )+dj )
413 temp = dnrm2( k, work, 1 )
414 CALL dgemv(
'T', k, nrhs, one, bx, ldbx, work, 1, zero,
416 CALL dlascl(
'G', 0, 0, temp, one, 1, nrhs, b( j, 1 ),
423 IF( k.LT.max( m, n ) )
424 $
CALL dlacpy(
'A', n-k, nrhs, bx( k+1, 1 ), ldbx,
434 CALL dcopy( nrhs, b, ldb, bx, ldbx )
437 dsigj = poles( j, 2 )
438 IF( z( j ).EQ.zero )
THEN
441 work( j ) = -z( j ) / difl( j ) /
442 $ ( dsigj+poles( j, 1 ) ) / difr( j, 2 )
445 IF( z( j ).EQ.zero )
THEN
453 work( i ) = z( j ) / ( dlamc3( dsigj, -poles( i+1,
454 $ 2 ) )-difr( i, 1 ) ) /
455 $ ( dsigj+poles( i, 1 ) ) / difr( i, 2 )
459 IF( z( j ).EQ.zero )
THEN
462 work( i ) = z( j ) / ( dlamc3( dsigj, -poles( i,
463 $ 2 ) )-difl( i ) ) /
464 $ ( dsigj+poles( i, 1 ) ) / difr( i, 2 )
467 CALL dgemv(
'T', k, nrhs, one, b, ldb, work, 1, zero,
476 CALL dcopy( nrhs, b( m, 1 ), ldb, bx( m, 1 ), ldbx )
477 CALL drot( nrhs, bx( 1, 1 ), ldbx, bx( m, 1 ), ldbx, c, s )
479 IF( k.LT.max( m, n ) )
480 $
CALL dlacpy(
'A', n-k, nrhs, b( k+1, 1 ), ldb, bx( k+1, 1 ),
485 CALL dcopy( nrhs, bx( 1, 1 ), ldbx, b( nlp1, 1 ), ldb )
487 CALL dcopy( nrhs, bx( m, 1 ), ldbx, b( m, 1 ), ldb )
490 CALL dcopy( nrhs, bx( i, 1 ), ldbx, b( perm( i ), 1 ), ldb )
495 DO 100 i = givptr, 1, -1
496 CALL drot( nrhs, b( givcol( i, 2 ), 1 ), ldb,
497 $ b( givcol( i, 1 ), 1 ), ldb, givnum( i, 2 ),
subroutine xerbla(srname, info)
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
subroutine dgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
DGEMV
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
subroutine dlals0(icompq, nl, nr, sqre, nrhs, b, ldb, bx, ldbx, perm, givptr, givcol, ldgcol, givnum, ldgnum, poles, difl, difr, z, k, c, s, work, info)
DLALS0 applies back multiplying factors in solving the least squares problem using divide and conquer...
subroutine dlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
DLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine drot(n, dx, incx, dy, incy, c, s)
DROT
subroutine dscal(n, da, dx, incx)
DSCAL