266 SUBROUTINE dlasd2( 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
276 DOUBLE PRECISION ALPHA, BETA
279 INTEGER COLTYP( * ), IDX( * ), IDXC( * ), IDXP( * ),
281 DOUBLE PRECISION D( * ), DSIGMA( * ), U( LDU, * ),
282 $ U2( LDU2, * ), VT( LDVT, * ), VT2( LDVT2, * ),
289 DOUBLE PRECISION ZERO, ONE, TWO, EIGHT
290 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0, two = 2.0d+0,
294 INTEGER CTOT( 4 ), PSM( 4 )
297 INTEGER CT, I, IDXI, IDXJ, IDXJP, J, JP, JPREV, K2, M,
299 DOUBLE PRECISION C, EPS, HLFTOL, S, TAU, TOL, Z1
302 DOUBLE PRECISION DLAMCH, DLAPY2
303 EXTERNAL DLAMCH, DLAPY2
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(
'DLASD2', -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 dlamrg( 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 = dlamch(
'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 drot( n, u( 1, idxjp ), 1, u( 1, idxj ), 1, c, s )
482 CALL drot( 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 dcopy( n, u( 1, idxj ), 1, u2( 1, j ), 1 )
558 CALL dcopy( m, vt( idxj, 1 ), ldvt, vt2( j, 1 ), ldvt2 )
565 IF( abs( dsigma( 2 ) ).LE.hlftol )
566 $ dsigma( 2 ) = hlftol
568 z( 1 ) = dlapy2( z1, z( m ) )
569 IF( z( 1 ).LE.tol )
THEN
578 IF( abs( z1 ).LE.tol )
THEN
587 CALL dcopy( k-1, u2( 2, 1 ), 1, z( 2 ), 1 )
592 CALL dlaset(
'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 dcopy( m, vt( nlp1, 1 ), ldvt, vt2( 1, 1 ), ldvt2 )
607 CALL dcopy( m, vt( m, 1 ), ldvt, vt2( m, 1 ), ldvt2 )
614 CALL dcopy( n-k, dsigma( k+1 ), 1, d( k+1 ), 1 )
615 CALL dlacpy(
'A', n, n-k, u2( 1, k+1 ), ldu2, u( 1, k+1 ),
617 CALL dlacpy(
'A', n-k, m, vt2( k+1, 1 ), ldvt2, vt( k+1, 1 ),
624 coltyp( j ) = ctot( j )
subroutine xerbla(srname, info)
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
subroutine dlamrg(n1, n2, a, dtrd1, dtrd2, index)
DLAMRG creates a permutation list to merge the entries of two independently sorted sets into a single...
subroutine dlasd2(nl, nr, sqre, k, d, z, alpha, beta, u, ldu, vt, ldvt, dsigma, u2, ldu2, vt2, ldvt2, idxp, idx, idxc, idxq, coltyp, info)
DLASD2 merges the two sets of singular values together into a single sorted set. Used by sbdsdc.
subroutine dlaset(uplo, m, n, alpha, beta, a, lda)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine drot(n, dx, incx, dy, incy, c, s)
DROT