214 SUBROUTINE dlasd3( NL, NR, SQRE, K, D, Q, LDQ, DSIGMA, U, LDU, U2,
215 $ LDU2, VT, LDVT, VT2, LDVT2, IDXC, CTOT, Z,
223 INTEGER INFO, K, LDQ, LDU, LDU2, LDVT, LDVT2, NL, NR,
227 INTEGER CTOT( * ), IDXC( * )
228 DOUBLE PRECISION D( * ), DSIGMA( * ), Q( LDQ, * ), U( LDU, * ),
229 $ u2( ldu2, * ), vt( ldvt, * ), vt2( ldvt2, * ),
236 DOUBLE PRECISION ONE, ZERO, NEGONE
237 PARAMETER ( ONE = 1.0d+0, zero = 0.0d+0,
241 INTEGER CTEMP, I, J, JC, KTEMP, M, N, NLP1, NLP2, NRP1
242 DOUBLE PRECISION RHO, TEMP
245 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, u,
371 IF( ctot( 1 ).GT.0 )
THEN
372 CALL dgemm(
'N',
'N', nl, k, ctot( 1 ), one, u2( 1, 2 ), ldu2,
373 $ q( 2, 1 ), ldq, zero, u( 1, 1 ), ldu )
374 IF( ctot( 3 ).GT.0 )
THEN
375 ktemp = 2 + ctot( 1 ) + ctot( 2 )
376 CALL dgemm(
'N',
'N', nl, k, ctot( 3 ), one, u2( 1, ktemp ),
377 $ ldu2, q( ktemp, 1 ), ldq, one, u( 1, 1 ), ldu )
379 ELSE IF( ctot( 3 ).GT.0 )
THEN
380 ktemp = 2 + ctot( 1 ) + ctot( 2 )
381 CALL dgemm(
'N',
'N', nl, k, ctot( 3 ), one, u2( 1, ktemp ),
382 $ ldu2, q( ktemp, 1 ), ldq, zero, u( 1, 1 ), ldu )
384 CALL dlacpy(
'F', nl, k, u2, ldu2, u, ldu )
386 CALL dcopy( k, q( 1, 1 ), ldq, u( nlp1, 1 ), ldu )
387 ktemp = 2 + ctot( 1 )
388 ctemp = ctot( 2 ) + ctot( 3 )
389 CALL dgemm(
'N',
'N', nr, k, ctemp, one, u2( nlp2, ktemp ), ldu2,
390 $ q( ktemp, 1 ), ldq, zero, u( nlp2, 1 ), ldu )
396 temp = dnrm2( k, vt( 1, i ), 1 )
397 q( i, 1 ) = vt( 1, i ) / temp
400 q( i, j ) = vt( jc, i ) / temp
407 CALL dgemm(
'N',
'N', k, m, k, one, q, ldq, vt2, ldvt2, zero,
411 ktemp = 1 + ctot( 1 )
412 CALL dgemm(
'N',
'N', k, nlp1, ktemp, one, q( 1, 1 ), ldq,
413 $ vt2( 1, 1 ), ldvt2, zero, vt( 1, 1 ), ldvt )
414 ktemp = 2 + ctot( 1 ) + ctot( 2 )
416 $
CALL dgemm(
'N',
'N', k, nlp1, ctot( 3 ), one, q( 1, ktemp ),
417 $ ldq, vt2( ktemp, 1 ), ldvt2, one, vt( 1, 1 ),
420 ktemp = ctot( 1 ) + 1
422 IF( ktemp.GT.1 )
THEN
424 q( i, ktemp ) = q( i, 1 )
427 vt2( ktemp, i ) = vt2( 1, i )
430 ctemp = 1 + ctot( 2 ) + ctot( 3 )
431 CALL dgemm(
'N',
'N', k, nrp1, ctemp, one, q( 1, ktemp ), ldq,
432 $ vt2( ktemp, nlp2 ), ldvt2, zero, vt( 1, nlp2 ), ldvt )
subroutine xerbla(srname, info)
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
subroutine dgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
DGEMM
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
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 dlasd3(nl, nr, sqre, k, d, q, ldq, dsigma, u, ldu, u2, ldu2, vt, ldvt, vt2, ldvt2, idxc, ctot, z, info)
DLASD3 finds all square roots of the roots of the secular equation, as defined by the values in D and...
subroutine dlasd4(n, i, d, z, delta, rho, sigma, work, info)
DLASD4 computes the square root of the i-th updated eigenvalue of a positive symmetric rank-one modif...