152 SUBROUTINE dlasd4( N, I, D, Z, DELTA, RHO, SIGMA, WORK, INFO )
160 DOUBLE PRECISION RHO, SIGMA
163 DOUBLE PRECISION D( * ), DELTA( * ), WORK( * ), Z( * )
170 parameter( maxit = 400 )
171 DOUBLE PRECISION ZERO, ONE, TWO, THREE, FOUR, EIGHT, TEN
172 parameter( zero = 0.0d+0, one = 1.0d+0, two = 2.0d+0,
173 $ three = 3.0d+0, four = 4.0d+0, eight = 8.0d+0,
177 LOGICAL ORGATI, SWTCH, SWTCH3, GEOMAVG
178 INTEGER II, IIM1, IIP1, IP1, ITER, J, NITER
179 DOUBLE PRECISION A, B, C, DELSQ, DELSQ2, SQ2, DPHI, DPSI, DTIIM,
180 $ DTIIP, DTIPSQ, DTISQ, DTNSQ, DTNSQ1, DW, EPS,
181 $ ERRETM, ETA, PHI, PREW, PSI, RHOINV, SGLB,
182 $ SGUB, TAU, TAU2, TEMP, TEMP1, TEMP2, W
185 DOUBLE PRECISION DD( 3 ), ZZ( 3 )
191 DOUBLE PRECISION DLAMCH
195 INTRINSIC abs, max, min, sqrt
209 sigma = sqrt( d( 1 )*d( 1 )+rho*z( 1 )*z( 1 ) )
215 CALL dlasd5( i, d, z, delta, rho, sigma, work )
221 eps = dlamch(
'Epsilon' )
241 temp1 = temp / ( d( n )+sqrt( d( n )*d( n )+temp ) )
243 work( j ) = d( j ) + d( n ) + temp1
244 delta( j ) = ( d( j )-d( n ) ) - temp1
249 psi = psi + z( j )*z( j ) / ( delta( j )*work( j ) )
253 w = c + z( ii )*z( ii ) / ( delta( ii )*work( ii ) ) +
254 $ z( n )*z( n ) / ( delta( n )*work( n ) )
257 temp1 = sqrt( d( n )*d( n )+rho )
258 temp = z( n-1 )*z( n-1 ) / ( ( d( n-1 )+temp1 )*
259 $ ( d( n )-d( n-1 )+rho / ( d( n )+temp1 ) ) ) +
260 $ z( n )*z( n ) / rho
268 delsq = ( d( n )-d( n-1 ) )*( d( n )+d( n-1 ) )
269 a = -c*delsq + z( n-1 )*z( n-1 ) + z( n )*z( n )
270 b = z( n )*z( n )*delsq
272 tau2 = two*b / ( sqrt( a*a+four*b*c )-a )
274 tau2 = ( a+sqrt( a*a+four*b*c ) ) / ( two*c )
276 tau = tau2 / ( d( n )+sqrt( d( n )*d( n )+tau2 ) )
283 delsq = ( d( n )-d( n-1 ) )*( d( n )+d( n-1 ) )
284 a = -c*delsq + z( n-1 )*z( n-1 ) + z( n )*z( n )
285 b = z( n )*z( n )*delsq
291 tau2 = two*b / ( sqrt( a*a+four*b*c )-a )
293 tau2 = ( a+sqrt( a*a+four*b*c ) ) / ( two*c )
295 tau = tau2 / ( d( n )+sqrt( d( n )*d( n )+tau2 ) )
309 delta( j ) = ( d( j )-d( n ) ) - tau
310 work( j ) = d( j ) + d( n ) + tau
319 temp = z( j ) / ( delta( j )*work( j ) )
320 psi = psi + z( j )*temp
321 dpsi = dpsi + temp*temp
322 erretm = erretm + psi
324 erretm = abs( erretm )
328 temp = z( n ) / ( delta( n )*work( n ) )
331 erretm = eight*( -phi-psi ) + erretm - phi + rhoinv
334 w = rhoinv + phi + psi
338 IF( abs( w ).LE.eps*erretm )
THEN
345 dtnsq1 = work( n-1 )*delta( n-1 )
346 dtnsq = work( n )*delta( n )
347 c = w - dtnsq1*dpsi - dtnsq*dphi
348 a = ( dtnsq+dtnsq1 )*w - dtnsq*dtnsq1*( dpsi+dphi )
353 eta = rho - sigma*sigma
354 ELSE IF( a.GE.zero )
THEN
355 eta = ( a+sqrt( abs( a*a-four*b*c ) ) ) / ( two*c )
357 eta = two*b / ( a-sqrt( abs( a*a-four*b*c ) ) )
367 $ eta = -w / ( dpsi+dphi )
372 eta = eta / ( sigma+sqrt( eta+sigma*sigma ) )
377 delta( j ) = delta( j ) - eta
378 work( j ) = work( j ) + eta
387 temp = z( j ) / ( work( j )*delta( j ) )
388 psi = psi + z( j )*temp
389 dpsi = dpsi + temp*temp
390 erretm = erretm + psi
392 erretm = abs( erretm )
396 tau2 = work( n )*delta( n )
400 erretm = eight*( -phi-psi ) + erretm - phi + rhoinv
403 w = rhoinv + phi + psi
409 DO 90 niter = iter, maxit
413 IF( abs( w ).LE.eps*erretm )
THEN
419 dtnsq1 = work( n-1 )*delta( n-1 )
420 dtnsq = work( n )*delta( n )
421 c = w - dtnsq1*dpsi - dtnsq*dphi
422 a = ( dtnsq+dtnsq1 )*w - dtnsq1*dtnsq*( dpsi+dphi )
425 eta = ( a+sqrt( abs( a*a-four*b*c ) ) ) / ( two*c )
427 eta = two*b / ( a-sqrt( abs( a*a-four*b*c ) ) )
437 $ eta = -w / ( dpsi+dphi )
442 eta = eta / ( sigma+sqrt( eta+sigma*sigma ) )
447 delta( j ) = delta( j ) - eta
448 work( j ) = work( j ) + eta
457 temp = z( j ) / ( work( j )*delta( j ) )
458 psi = psi + z( j )*temp
459 dpsi = dpsi + temp*temp
460 erretm = erretm + psi
462 erretm = abs( erretm )
466 tau2 = work( n )*delta( n )
470 erretm = eight*( -phi-psi ) + erretm - phi + rhoinv
473 w = rhoinv + phi + psi
492 delsq = ( d( ip1 )-d( i ) )*( d( ip1 )+d( i ) )
494 sq2=sqrt( ( d( i )*d( i )+d( ip1 )*d( ip1 ) ) / two )
495 temp = delsq2 / ( d( i )+sq2 )
497 work( j ) = d( j ) + d( i ) + temp
498 delta( j ) = ( d( j )-d( i ) ) - temp
503 psi = psi + z( j )*z( j ) / ( work( j )*delta( j ) )
507 DO 120 j = n, i + 2, -1
508 phi = phi + z( j )*z( j ) / ( work( j )*delta( j ) )
510 c = rhoinv + psi + phi
511 w = c + z( i )*z( i ) / ( work( i )*delta( i ) ) +
512 $ z( ip1 )*z( ip1 ) / ( work( ip1 )*delta( ip1 ) )
524 sgub = delsq2 / ( d( i )+sq2 )
525 a = c*delsq + z( i )*z( i ) + z( ip1 )*z( ip1 )
526 b = z( i )*z( i )*delsq
528 tau2 = two*b / ( a+sqrt( abs( a*a-four*b*c ) ) )
530 tau2 = ( a-sqrt( abs( a*a-four*b*c ) ) ) / ( two*c )
537 tau = tau2 / ( d( i )+sqrt( d( i )*d( i )+tau2 ) )
539 IF( (d(i).LE.temp*d(ip1)).AND.(abs(z(i)).LE.temp)
540 $ .AND.(d(i).GT.zero) )
THEN
541 tau = min( ten*d(i), sgub )
552 sglb = -delsq2 / ( d( ii )+sq2 )
554 a = c*delsq - z( i )*z( i ) - z( ip1 )*z( ip1 )
555 b = z( ip1 )*z( ip1 )*delsq
557 tau2 = two*b / ( a-sqrt( abs( a*a+four*b*c ) ) )
559 tau2 = -( a+sqrt( abs( a*a+four*b*c ) ) ) / ( two*c )
566 tau = tau2 / ( d( ip1 )+sqrt( abs( d( ip1 )*d( ip1 )+
570 sigma = d( ii ) + tau
572 work( j ) = d( j ) + d( ii ) + tau
573 delta( j ) = ( d( j )-d( ii ) ) - tau
584 temp = z( j ) / ( work( j )*delta( j ) )
585 psi = psi + z( j )*temp
586 dpsi = dpsi + temp*temp
587 erretm = erretm + psi
589 erretm = abs( erretm )
595 DO 160 j = n, iip1, -1
596 temp = z( j ) / ( work( j )*delta( j ) )
597 phi = phi + z( j )*temp
598 dphi = dphi + temp*temp
599 erretm = erretm + phi
602 w = rhoinv + phi + psi
615 IF( ii.EQ.1 .OR. ii.EQ.n )
618 temp = z( ii ) / ( work( ii )*delta( ii ) )
619 dw = dpsi + dphi + temp*temp
622 erretm = eight*( phi-psi ) + erretm + two*rhoinv
623 $ + three*abs( temp )
628 IF( abs( w ).LE.eps*erretm )
THEN
633 sglb = max( sglb, tau )
635 sgub = min( sgub, tau )
641 IF( .NOT.swtch3 )
THEN
642 dtipsq = work( ip1 )*delta( ip1 )
643 dtisq = work( i )*delta( i )
645 c = w - dtipsq*dw + delsq*( z( i ) / dtisq )**2
647 c = w - dtisq*dw - delsq*( z( ip1 ) / dtipsq )**2
649 a = ( dtipsq+dtisq )*w - dtipsq*dtisq*dw
654 a = z( i )*z( i ) + dtipsq*dtipsq*( dpsi+dphi )
656 a = z( ip1 )*z( ip1 ) + dtisq*dtisq*( dpsi+dphi )
660 ELSE IF( a.LE.zero )
THEN
661 eta = ( a-sqrt( abs( a*a-four*b*c ) ) ) / ( two*c )
663 eta = two*b / ( a+sqrt( abs( a*a-four*b*c ) ) )
669 dtiim = work( iim1 )*delta( iim1 )
670 dtiip = work( iip1 )*delta( iip1 )
671 temp = rhoinv + psi + phi
673 temp1 = z( iim1 ) / dtiim
675 c = ( temp - dtiip*( dpsi+dphi ) ) -
676 $ ( d( iim1 )-d( iip1 ) )*( d( iim1 )+d( iip1 ) )*temp1
677 zz( 1 ) = z( iim1 )*z( iim1 )
678 IF( dpsi.LT.temp1 )
THEN
679 zz( 3 ) = dtiip*dtiip*dphi
681 zz( 3 ) = dtiip*dtiip*( ( dpsi-temp1 )+dphi )
684 temp1 = z( iip1 ) / dtiip
686 c = ( temp - dtiim*( dpsi+dphi ) ) -
687 $ ( d( iip1 )-d( iim1 ) )*( d( iim1 )+d( iip1 ) )*temp1
688 IF( dphi.LT.temp1 )
THEN
689 zz( 1 ) = dtiim*dtiim*dpsi
691 zz( 1 ) = dtiim*dtiim*( dpsi+( dphi-temp1 ) )
693 zz( 3 ) = z( iip1 )*z( iip1 )
695 zz( 2 ) = z( ii )*z( ii )
697 dd( 2 ) = delta( ii )*work( ii )
699 CALL dlaed6( niter, orgati, c, dd, zz, w, eta, info )
708 dtipsq = work( ip1 )*delta( ip1 )
709 dtisq = work( i )*delta( i )
711 c = w - dtipsq*dw + delsq*( z( i ) / dtisq )**2
713 c = w - dtisq*dw - delsq*( z( ip1 ) / dtipsq )**2
715 a = ( dtipsq+dtisq )*w - dtipsq*dtisq*dw
720 a = z( i )*z( i ) + dtipsq*dtipsq*( dpsi+dphi )
722 a = z( ip1 )*z( ip1 ) + dtisq*dtisq*( dpsi+dphi)
726 ELSE IF( a.LE.zero )
THEN
727 eta = ( a-sqrt( abs( a*a-four*b*c ) ) ) / ( two*c )
729 eta = two*b / ( a+sqrt( abs( a*a-four*b*c ) ) )
743 eta = eta / ( sigma+sqrt( sigma*sigma+eta ) )
745 IF( temp.GT.sgub .OR. temp.LT.sglb )
THEN
747 eta = ( sgub-tau ) / two
749 eta = ( sglb-tau ) / two
752 IF( w .LT. zero )
THEN
753 IF( tau .GT. zero )
THEN
754 eta = sqrt(sgub*tau)-tau
757 IF( sglb .GT. zero )
THEN
758 eta = sqrt(sglb*tau)-tau
770 work( j ) = work( j ) + eta
771 delta( j ) = delta( j ) - eta
780 temp = z( j ) / ( work( j )*delta( j ) )
781 psi = psi + z( j )*temp
782 dpsi = dpsi + temp*temp
783 erretm = erretm + psi
785 erretm = abs( erretm )
791 DO 190 j = n, iip1, -1
792 temp = z( j ) / ( work( j )*delta( j ) )
793 phi = phi + z( j )*temp
794 dphi = dphi + temp*temp
795 erretm = erretm + phi
798 tau2 = work( ii )*delta( ii )
799 temp = z( ii ) / tau2
800 dw = dpsi + dphi + temp*temp
802 w = rhoinv + phi + psi + temp
803 erretm = eight*( phi-psi ) + erretm + two*rhoinv
804 $ + three*abs( temp )
809 IF( -w.GT.abs( prew ) / ten )
812 IF( w.GT.abs( prew ) / ten )
820 DO 230 niter = iter, maxit
824 IF( abs( w ).LE.eps*erretm )
THEN
830 sglb = max( sglb, tau )
832 sgub = min( sgub, tau )
837 IF( .NOT.swtch3 )
THEN
838 dtipsq = work( ip1 )*delta( ip1 )
839 dtisq = work( i )*delta( i )
840 IF( .NOT.swtch )
THEN
842 c = w - dtipsq*dw + delsq*( z( i ) / dtisq )**2
844 c = w - dtisq*dw - delsq*( z( ip1 ) / dtipsq )**2
847 temp = z( ii ) / ( work( ii )*delta( ii ) )
849 dpsi = dpsi + temp*temp
851 dphi = dphi + temp*temp
853 c = w - dtisq*dpsi - dtipsq*dphi
855 a = ( dtipsq+dtisq )*w - dtipsq*dtisq*dw
859 IF( .NOT.swtch )
THEN
861 a = z( i )*z( i ) + dtipsq*dtipsq*
864 a = z( ip1 )*z( ip1 ) +
865 $ dtisq*dtisq*( dpsi+dphi )
868 a = dtisq*dtisq*dpsi + dtipsq*dtipsq*dphi
872 ELSE IF( a.LE.zero )
THEN
873 eta = ( a-sqrt( abs( a*a-four*b*c ) ) ) / ( two*c )
875 eta = two*b / ( a+sqrt( abs( a*a-four*b*c ) ) )
881 dtiim = work( iim1 )*delta( iim1 )
882 dtiip = work( iip1 )*delta( iip1 )
883 temp = rhoinv + psi + phi
885 c = temp - dtiim*dpsi - dtiip*dphi
886 zz( 1 ) = dtiim*dtiim*dpsi
887 zz( 3 ) = dtiip*dtiip*dphi
890 temp1 = z( iim1 ) / dtiim
892 temp2 = ( d( iim1 )-d( iip1 ) )*
893 $ ( d( iim1 )+d( iip1 ) )*temp1
894 c = temp - dtiip*( dpsi+dphi ) - temp2
895 zz( 1 ) = z( iim1 )*z( iim1 )
896 IF( dpsi.LT.temp1 )
THEN
897 zz( 3 ) = dtiip*dtiip*dphi
899 zz( 3 ) = dtiip*dtiip*( ( dpsi-temp1 )+dphi )
902 temp1 = z( iip1 ) / dtiip
904 temp2 = ( d( iip1 )-d( iim1 ) )*
905 $ ( d( iim1 )+d( iip1 ) )*temp1
906 c = temp - dtiim*( dpsi+dphi ) - temp2
907 IF( dphi.LT.temp1 )
THEN
908 zz( 1 ) = dtiim*dtiim*dpsi
910 zz( 1 ) = dtiim*dtiim*( dpsi+( dphi-temp1 ) )
912 zz( 3 ) = z( iip1 )*z( iip1 )
916 dd( 2 ) = delta( ii )*work( ii )
918 CALL dlaed6( niter, orgati, c, dd, zz, w, eta, info )
927 dtipsq = work( ip1 )*delta( ip1 )
928 dtisq = work( i )*delta( i )
929 IF( .NOT.swtch )
THEN
931 c = w - dtipsq*dw + delsq*( z( i )/dtisq )**2
933 c = w - dtisq*dw - delsq*( z( ip1 )/dtipsq )**2
936 temp = z( ii ) / ( work( ii )*delta( ii ) )
938 dpsi = dpsi + temp*temp
940 dphi = dphi + temp*temp
942 c = w - dtisq*dpsi - dtipsq*dphi
944 a = ( dtipsq+dtisq )*w - dtipsq*dtisq*dw
948 IF( .NOT.swtch )
THEN
950 a = z( i )*z( i ) + dtipsq*dtipsq*
953 a = z( ip1 )*z( ip1 ) +
954 $ dtisq*dtisq*( dpsi+dphi )
957 a = dtisq*dtisq*dpsi + dtipsq*dtipsq*dphi
961 ELSE IF( a.LE.zero )
THEN
962 eta = ( a-sqrt( abs( a*a-four*b*c ) ) ) / ( two*c )
964 eta = two*b / ( a+sqrt( abs( a*a-four*b*c ) ) )
978 eta = eta / ( sigma+sqrt( sigma*sigma+eta ) )
980 IF( temp.GT.sgub .OR. temp.LT.sglb )
THEN
982 eta = ( sgub-tau ) / two
984 eta = ( sglb-tau ) / two
987 IF( w .LT. zero )
THEN
988 IF( tau .GT. zero )
THEN
989 eta = sqrt(sgub*tau)-tau
992 IF( sglb .GT. zero )
THEN
993 eta = sqrt(sglb*tau)-tau
1005 work( j ) = work( j ) + eta
1006 delta( j ) = delta( j ) - eta
1015 temp = z( j ) / ( work( j )*delta( j ) )
1016 psi = psi + z( j )*temp
1017 dpsi = dpsi + temp*temp
1018 erretm = erretm + psi
1020 erretm = abs( erretm )
1026 DO 220 j = n, iip1, -1
1027 temp = z( j ) / ( work( j )*delta( j ) )
1028 phi = phi + z( j )*temp
1029 dphi = dphi + temp*temp
1030 erretm = erretm + phi
1033 tau2 = work( ii )*delta( ii )
1034 temp = z( ii ) / tau2
1035 dw = dpsi + dphi + temp*temp
1037 w = rhoinv + phi + psi + temp
1038 erretm = eight*( phi-psi ) + erretm + two*rhoinv
1039 $ + three*abs( temp )
1042 IF( w*prew.GT.zero .AND. abs( w ).GT.abs( prew ) / ten )
1043 $ swtch = .NOT.swtch
subroutine dlaed6(kniter, orgati, rho, d, z, finit, tau, info)
DLAED6 used by DSTEDC. Computes one Newton step in solution of the secular equation.
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...
subroutine dlasd5(i, d, z, delta, rho, dsigma, work)
DLASD5 computes the square root of the i-th eigenvalue of a positive symmetric rank-one modification ...