212 SUBROUTINE dlasd3( NL, NR, SQRE, K, D, Q, LDQ, DSIGMA, U, LDU,
214 $ LDU2, VT, LDVT, VT2, LDVT2, IDXC, CTOT, Z,
222 INTEGER INFO, K, LDQ, LDU, LDU2, LDVT, LDVT2, NL, NR,
226 INTEGER CTOT( * ), IDXC( * )
227 DOUBLE PRECISION D( * ), DSIGMA( * ), Q( LDQ, * ), U( LDU, * ),
228 $ U2( LDU2, * ), VT( LDVT, * ), VT2( LDVT2, * ),
235 DOUBLE PRECISION ONE, ZERO, NEGONE
236 PARAMETER ( ONE = 1.0d+0, zero = 0.0d+0,
240 INTEGER CTEMP, I, J, JC, KTEMP, M, N, NLP1, NLP2, NRP1
241 DOUBLE PRECISION RHO, TEMP
244 DOUBLE PRECISION DNRM2
252 INTRINSIC abs, sign, sqrt
262 ELSE IF( nr.LT.1 )
THEN
264 ELSE IF( ( sqre.NE.1 ) .AND. ( sqre.NE.0 ) )
THEN
273 IF( ( k.LT.1 ) .OR. ( k.GT.n ) )
THEN
275 ELSE IF( ldq.LT.k )
THEN
277 ELSE IF( ldu.LT.n )
THEN
279 ELSE IF( ldu2.LT.n )
THEN
281 ELSE IF( ldvt.LT.m )
THEN
283 ELSE IF( ldvt2.LT.m )
THEN
287 CALL xerbla(
'DLASD3', -info )
294 d( 1 ) = abs( z( 1 ) )
295 CALL dcopy( m, vt2( 1, 1 ), ldvt2, vt( 1, 1 ), ldvt )
296 IF( z( 1 ).GT.zero )
THEN
297 CALL dcopy( n, u2( 1, 1 ), 1, u( 1, 1 ), 1 )
300 u( i, 1 ) = -u2( i, 1 )
308 CALL dcopy( k, z, 1, q, 1 )
312 rho = dnrm2( k, z, 1 )
313 CALL dlascl(
'G', 0, 0, rho, one, k, 1, z, k, info )
319 CALL dlasd4( k, j, dsigma, z, u( 1, j ), rho, d( j ),
332 z( i ) = u( i, k )*vt( i, k )
334 z( i ) = z( i )*( u( i, j )*vt( i, j ) /
335 $ ( dsigma( i )-dsigma( j ) ) /
336 $ ( dsigma( i )+dsigma( j ) ) )
339 z( i ) = z( i )*( u( i, j )*vt( i, j ) /
340 $ ( dsigma( i )-dsigma( j+1 ) ) /
341 $ ( dsigma( i )+dsigma( j+1 ) ) )
343 z( i ) = sign( sqrt( abs( z( i ) ) ), q( i, 1 ) )
350 vt( 1, i ) = z( 1 ) / u( 1, i ) / vt( 1, i )
353 vt( j, i ) = z( j ) / u( j, i ) / vt( j, i )
354 u( j, i ) = dsigma( j )*vt( j, i )
356 temp = dnrm2( k, u( 1, i ), 1 )
357 q( 1, i ) = u( 1, i ) / temp
360 q( j, i ) = u( jc, i ) / temp
367 CALL dgemm(
'N',
'N', n, k, k, one, u2, ldu2, q, ldq, zero,
372 IF( ctot( 1 ).GT.0 )
THEN
373 CALL dgemm(
'N',
'N', nl, k, ctot( 1 ), one, u2( 1, 2 ),
375 $ q( 2, 1 ), ldq, zero, u( 1, 1 ), ldu )
376 IF( ctot( 3 ).GT.0 )
THEN
377 ktemp = 2 + ctot( 1 ) + ctot( 2 )
378 CALL dgemm(
'N',
'N', nl, k, ctot( 3 ), one, u2( 1,
380 $ ldu2, q( ktemp, 1 ), ldq, one, u( 1, 1 ), ldu )
382 ELSE IF( ctot( 3 ).GT.0 )
THEN
383 ktemp = 2 + ctot( 1 ) + ctot( 2 )
384 CALL dgemm(
'N',
'N', nl, k, ctot( 3 ), one, u2( 1, ktemp ),
385 $ ldu2, q( ktemp, 1 ), ldq, zero, u( 1, 1 ), ldu )
387 CALL dlacpy(
'F', nl, k, u2, ldu2, u, ldu )
389 CALL dcopy( k, q( 1, 1 ), ldq, u( nlp1, 1 ), ldu )
390 ktemp = 2 + ctot( 1 )
391 ctemp = ctot( 2 ) + ctot( 3 )
392 CALL dgemm(
'N',
'N', nr, k, ctemp, one, u2( nlp2, ktemp ),
394 $ q( ktemp, 1 ), ldq, zero, u( nlp2, 1 ), ldu )
400 temp = dnrm2( k, vt( 1, i ), 1 )
401 q( i, 1 ) = vt( 1, i ) / temp
404 q( i, j ) = vt( jc, i ) / temp
411 CALL dgemm(
'N',
'N', k, m, k, one, q, ldq, vt2, ldvt2,
416 ktemp = 1 + ctot( 1 )
417 CALL dgemm(
'N',
'N', k, nlp1, ktemp, one, q( 1, 1 ), ldq,
418 $ vt2( 1, 1 ), ldvt2, zero, vt( 1, 1 ), ldvt )
419 ktemp = 2 + ctot( 1 ) + ctot( 2 )
421 $
CALL dgemm(
'N',
'N', k, nlp1, ctot( 3 ), one, q( 1,
423 $ ldq, vt2( ktemp, 1 ), ldvt2, one, vt( 1, 1 ),
426 ktemp = ctot( 1 ) + 1
428 IF( ktemp.GT.1 )
THEN
430 q( i, ktemp ) = q( i, 1 )
433 vt2( ktemp, i ) = vt2( 1, i )
436 ctemp = 1 + ctot( 2 ) + ctot( 3 )
437 CALL dgemm(
'N',
'N', k, nrp1, ctemp, one, q( 1, ktemp ), ldq,
438 $ vt2( ktemp, nlp2 ), ldvt2, zero, vt( 1, nlp2 ), ldvt )