267 SUBROUTINE clals0( 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
281 INTEGER GIVCOL( LDGCOL, * ), PERM( * )
282 REAL DIFL( * ), DIFR( LDGNUM, * ),
283 $ givnum( ldgnum, * ), poles( ldgnum, * ),
285 COMPLEX B( LDB, * ), BX( LDBX, * )
291 REAL ONE, ZERO, NEGONE
292 PARAMETER ( ONE = 1.0e0, zero = 0.0e0, negone = -1.0e0 )
295 INTEGER I, J, JCOL, JROW, M, N, NLP1
296 REAL DIFLJ, DIFRJ, DJ, DSIGJ, DSIGJP, TEMP
304 EXTERNAL SLAMC3, SNRM2
307 INTRINSIC aimag, cmplx, max, real
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(
'CLALS0', -info )
347 IF( icompq.EQ.0 )
THEN
354 CALL csrot( nrhs, b( givcol( i, 2 ), 1 ), ldb,
355 $ b( givcol( i, 1 ), 1 ), ldb, givnum( i, 2 ),
361 CALL ccopy( nrhs, b( nlp1, 1 ), ldb, bx( 1, 1 ), ldbx )
363 CALL ccopy( nrhs, b( perm( i ), 1 ), ldb, bx( i, 1 ), ldbx )
370 CALL ccopy( nrhs, bx, ldbx, b, ldb )
371 IF( z( 1 ).LT.zero )
THEN
372 CALL csscal( 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 $ ( slamc3( 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 $ ( slamc3( poles( i, 2 ), dsigjp )+
412 $ difrj ) / ( poles( i, 2 )+dj )
416 temp = snrm2( k, rwork, 1 )
428 rwork( i ) = real( bx( jrow, jcol ) )
431 CALL sgemv(
'T', k, nrhs, one, rwork( 1+k+nrhs*2 ), k,
432 $ rwork( 1 ), 1, zero, rwork( 1+k ), 1 )
437 rwork( i ) = aimag( bx( jrow, jcol ) )
440 CALL sgemv(
'T', k, nrhs, one, rwork( 1+k+nrhs*2 ), k,
441 $ rwork( 1 ), 1, zero, rwork( 1+k+nrhs ), 1 )
443 b( j, jcol ) = cmplx( rwork( jcol+k ),
444 $ rwork( jcol+k+nrhs ) )
446 CALL clascl(
'G', 0, 0, temp, one, 1, nrhs, b( j, 1 ),
453 IF( k.LT.max( m, n ) )
454 $
CALL clacpy(
'A', n-k, nrhs, bx( k+1, 1 ), ldbx,
464 CALL ccopy( 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 ) / ( slamc3( 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 ) / ( slamc3( dsigj, -poles( i,
493 $ 2 ) )-difl( i ) ) /
494 $ ( dsigj+poles( i, 1 ) ) / difr( i, 2 )
505 DO 140 jcol = 1, nrhs
508 rwork( i ) = real( b( jrow, jcol ) )
511 CALL sgemv(
'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 ) = aimag( b( jrow, jcol ) )
520 CALL sgemv(
'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 ) = cmplx( rwork( jcol+k ),
524 $ rwork( jcol+k+nrhs ) )
533 CALL ccopy( nrhs, b( m, 1 ), ldb, bx( m, 1 ), ldbx )
534 CALL csrot( nrhs, bx( 1, 1 ), ldbx, bx( m, 1 ), ldbx, c, s )
536 IF( k.LT.max( m, n ) )
537 $
CALL clacpy(
'A', n-k, nrhs, b( k+1, 1 ), ldb,
538 $ bx( k+1, 1 ), ldbx )
542 CALL ccopy( nrhs, bx( 1, 1 ), ldbx, b( nlp1, 1 ), ldb )
544 CALL ccopy( nrhs, bx( m, 1 ), ldbx, b( m, 1 ), ldb )
547 CALL ccopy( nrhs, bx( i, 1 ), ldbx, b( perm( i ), 1 ), ldb )
552 DO 200 i = givptr, 1, -1
553 CALL csrot( nrhs, b( givcol( i, 2 ), 1 ), ldb,
554 $ b( givcol( i, 1 ), 1 ), ldb, givnum( i, 2 ),
subroutine xerbla(srname, info)
subroutine ccopy(n, cx, incx, cy, incy)
CCOPY
subroutine sgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
SGEMV
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
subroutine clals0(icompq, nl, nr, sqre, nrhs, b, ldb, bx, ldbx, perm, givptr, givcol, ldgcol, givnum, ldgnum, poles, difl, difr, z, k, c, s, rwork, info)
CLALS0 applies back multiplying factors in solving the least squares problem using divide and conquer...
subroutine clascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
CLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine csrot(n, cx, incx, cy, incy, c, s)
CSROT
subroutine csscal(n, sa, cx, incx)
CSSCAL