266 SUBROUTINE slasd2( NL, NR, SQRE, K, D, Z, ALPHA, BETA, U, LDU, VT,
267 $ LDVT, DSIGMA, U2, LDU2, VT2, LDVT2, IDXP, IDX,
268 $ IDXC, IDXQ, COLTYP, INFO )
275 INTEGER INFO, K, LDU, LDU2, LDVT, LDVT2, NL, NR, SQRE
279 INTEGER COLTYP( * ), IDX( * ), IDXC( * ), IDXP( * ),
281 REAL D( * ), DSIGMA( * ), U( LDU, * ),
282 $ U2( LDU2, * ), VT( LDVT, * ), VT2( LDVT2, * ),
289 REAL ZERO, ONE, TWO, EIGHT
290 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0, two = 2.0e+0,
294 INTEGER CTOT( 4 ), PSM( 4 )
297 INTEGER CT, I, IDXI, IDXJ, IDXJP, J, JP, JPREV, K2, M,
299 REAL C, EPS, HLFTOL, S, TAU, TOL, Z1
303 EXTERNAL SLAMCH, SLAPY2
319 ELSE IF( nr.LT.1 )
THEN
321 ELSE IF( ( sqre.NE.1 ) .AND. ( sqre.NE.0 ) )
THEN
330 ELSE IF( ldvt.LT.m )
THEN
332 ELSE IF( ldu2.LT.n )
THEN
334 ELSE IF( ldvt2.LT.m )
THEN
338 CALL xerbla(
'SLASD2', -info )
348 z1 = alpha*vt( nlp1, nlp1 )
351 z( i+1 ) = alpha*vt( i, nlp1 )
353 idxq( i+1 ) = idxq( i ) + 1
359 z( i ) = beta*vt( i, nlp2 )
374 idxq( i ) = idxq( i ) + nlp1
381 dsigma( i ) = d( idxq( i ) )
382 u2( i, 1 ) = z( idxq( i ) )
383 idxc( i ) = coltyp( idxq( i ) )
386 CALL slamrg( nl, nr, dsigma( 2 ), 1, 1, idx( 2 ) )
390 d( i ) = dsigma( idxi )
391 z( i ) = u2( idxi, 1 )
392 coltyp( i ) = idxc( idxi )
397 eps = slamch(
'Epsilon' )
398 tol = max( abs( alpha ), abs( beta ) )
399 tol = eight*eps*max( abs( d( n ) ), tol )
423 IF( abs( z( j ) ).LE.tol )
THEN
443 IF( abs( z( j ) ).LE.tol )
THEN
454 IF( abs( d( j )-d( jprev ) ).LE.tol )
THEN
473 idxjp = idxq( idx( jprev )+1 )
474 idxj = idxq( idx( j )+1 )
475 IF( idxjp.LE.nlp1 )
THEN
478 IF( idxj.LE.nlp1 )
THEN
481 CALL srot( n, u( 1, idxjp ), 1, u( 1, idxj ), 1, c, s )
482 CALL srot( m, vt( idxjp, 1 ), ldvt, vt( idxj, 1 ), ldvt, c,
484 IF( coltyp( j ).NE.coltyp( jprev ) )
THEN
493 u2( k, 1 ) = z( jprev )
494 dsigma( k ) = d( jprev )
505 u2( k, 1 ) = z( jprev )
506 dsigma( k ) = d( jprev )
521 ctot( ct ) = ctot( ct ) + 1
527 psm( 2 ) = 2 + ctot( 1 )
528 psm( 3 ) = psm( 2 ) + ctot( 2 )
529 psm( 4 ) = psm( 3 ) + ctot( 3 )
539 idxc( psm( ct ) ) = j
540 psm( ct ) = psm( ct ) + 1
552 dsigma( j ) = d( jp )
553 idxj = idxq( idx( idxp( idxc( j ) ) )+1 )
554 IF( idxj.LE.nlp1 )
THEN
557 CALL scopy( n, u( 1, idxj ), 1, u2( 1, j ), 1 )
558 CALL scopy( m, vt( idxj, 1 ), ldvt, vt2( j, 1 ), ldvt2 )
565 IF( abs( dsigma( 2 ) ).LE.hlftol )
566 $ dsigma( 2 ) = hlftol
568 z( 1 ) = slapy2( z1, z( m ) )
569 IF( z( 1 ).LE.tol )
THEN
578 IF( abs( z1 ).LE.tol )
THEN
587 CALL scopy( k-1, u2( 2, 1 ), 1, z( 2 ), 1 )
592 CALL slaset(
'A', n, 1, zero, zero, u2, ldu2 )
596 vt( m, i ) = -s*vt( nlp1, i )
597 vt2( 1, i ) = c*vt( nlp1, i )
600 vt2( 1, i ) = s*vt( m, i )
601 vt( m, i ) = c*vt( m, i )
604 CALL scopy( m, vt( nlp1, 1 ), ldvt, vt2( 1, 1 ), ldvt2 )
607 CALL scopy( m, vt( m, 1 ), ldvt, vt2( m, 1 ), ldvt2 )
614 CALL scopy( n-k, dsigma( k+1 ), 1, d( k+1 ), 1 )
615 CALL slacpy(
'A', n, n-k, u2( 1, k+1 ), ldu2, u( 1, k+1 ),
617 CALL slacpy(
'A', n-k, m, vt2( k+1, 1 ), ldvt2, vt( k+1, 1 ),
624 coltyp( j ) = ctot( j )
subroutine xerbla(srname, info)
subroutine scopy(n, sx, incx, sy, incy)
SCOPY
subroutine slacpy(uplo, m, n, a, lda, b, ldb)
SLACPY copies all or part of one two-dimensional array to another.
subroutine slamrg(n1, n2, a, strd1, strd2, index)
SLAMRG creates a permutation list to merge the entries of two independently sorted sets into a single...
subroutine slasd2(nl, nr, sqre, k, d, z, alpha, beta, u, ldu, vt, ldvt, dsigma, u2, ldu2, vt2, ldvt2, idxp, idx, idxc, idxq, coltyp, info)
SLASD2 merges the two sets of singular values together into a single sorted set. Used by sbdsdc.
subroutine slaset(uplo, m, n, alpha, beta, a, lda)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine srot(n, sx, incx, sy, incy, c, s)
SROT