12 DOUBLE PRECISION Z( * )
70 DOUBLE PRECISION CBIAS
71 parameter( cbias = 1.50d0 )
72 DOUBLE PRECISION ZERO, HALF, ONE, TWO, FOUR, HUNDRD
73 parameter( zero = 0.0d0, half = 0.5d0, one = 1.0d0,
74 $ two = 2.0d0, four = 4.0d0, hundrd = 100.0d0 )
78 INTEGER I0, I4, IINFO, IPN4, ITER, IWHILA, IWHILB, K,
79 $ N0, NBIG, NDIV, NFAIL, PP, SPLT
80 DOUBLE PRECISION D, DESIG, DMIN, E, EMAX, EMIN, EPS, OLDEMN,
81 $ QMAX, QMIN, S, SAFMIN, SIGMA, T, TEMP, TOL,
89 DOUBLE PRECISION DLAMCH
90 EXTERNAL dlamch, ilaenv
93 INTRINSIC dble, max, min, sqrt
101 eps = dlamch(
'Precision' )
102 safmin = dlamch(
'Safe minimum' )
108 CALL xerbla(
'DLASQ2', 1 )
110 ELSE IF( n.EQ.0 )
THEN
112 ELSE IF( n.EQ.1 )
THEN
116 IF( z( 1 ).LT.zero )
THEN
118 CALL xerbla(
'DLASQ2', 2 )
121 ELSE IF( n.EQ.2 )
THEN
125 IF( z( 2 ).LT.zero .OR. z( 3 ).LT.zero )
THEN
127 CALL xerbla(
'DLASQ2', 2 )
129 ELSE IF( z( 3 ).GT.z( 1 ) )
THEN
134 z( 5 ) = z( 1 ) + z( 2 ) + z( 3 )
135 IF( z( 2 ).GT.z( 3 )*tol2 )
THEN
136 t = half*( ( z( 1 )-z( 3 ) )+z( 2 ) )
137 s = z( 3 )*( z( 2 ) / t )
139 s = z( 3 )*( z( 2 ) / ( t*( one+sqrt( one+s / t ) ) ) )
141 s = z( 3 )*( z( 2 ) / ( t+sqrt( t )*sqrt( t+s ) ) )
143 t = z( 1 ) + ( s+z( 2 ) )
144 z( 3 ) = z( 3 )*( z( 1 ) / t )
148 z( 6 ) = z( 2 ) + z( 1 )
161 DO 10 k = 1, 2*( n-1 ), 2
162 IF( z( k ).LT.zero )
THEN
164 CALL xerbla(
'DLASQ2', 2 )
166 ELSE IF( z( k+1 ).LT.zero )
THEN
168 CALL xerbla(
'DLASQ2', 2 )
173 qmax = max( qmax, z( k ) )
174 emin = min( emin, z( k+1 ) )
175 zmax = max( qmax, zmax, z( k+1 ) )
177 IF( z( 2*n-1 ).LT.zero )
THEN
178 info = -( 200+2*n-1 )
179 CALL xerbla(
'DLASQ2', 2 )
183 qmax = max( qmax, z( 2*n-1 ) )
184 zmax = max( qmax, zmax )
192 CALL dlasrt(
'D', n, z, iinfo )
201 IF( trace.EQ.zero )
THEN
208 ieee = ilaenv( 10,
'DLASQ2',
'N', 1, 2, 3, 4 ).EQ.1 .AND.
209 $ ilaenv( 11,
'DLASQ2',
'N', 1, 2, 3, 4 ).EQ.1
217 z( 2*k-3 ) = z( k-1 )
225 IF( cbias*z( 4*i0-3 ).LT.z( 4*n0-3 ) )
THEN
227 DO 40 i4 = 4*i0, 2*( i0+n0-1 ), 4
229 z( i4-3 ) = z( ipn4-i4-3 )
230 z( ipn4-i4-3 ) = temp
232 z( i4-1 ) = z( ipn4-i4-5 )
233 z( ipn4-i4-5 ) = temp
244 DO 50 i4 = 4*( n0-1 ) + pp, 4*i0 + pp, -4
245 IF( z( i4-1 ).LE.tol2*d )
THEN
249 d = z( i4-3 )*( d / ( d+z( i4-1 ) ) )
255 emin = z( 4*i0+pp+1 )
257 DO 60 i4 = 4*i0 + pp, 4*( n0-1 ) + pp, 4
258 z( i4-2*pp-2 ) = d + z( i4-1 )
259 IF( z( i4-1 ).LE.tol2*d )
THEN
264 ELSE IF( safmin*z( i4+1 ).LT.z( i4-2*pp-2 ) .AND.
265 $ safmin*z( i4-2*pp-2 ).LT.z( i4+1 ) )
THEN
266 temp = z( i4+1 ) / z( i4-2*pp-2 )
267 z( i4-2*pp ) = z( i4-1 )*temp
270 z( i4-2*pp ) = z( i4+1 )*( z( i4-1 ) / z( i4-2*pp-2 ) )
271 d = z( i4+1 )*( d / z( i4-2*pp-2 ) )
273 emin = min( emin, z( i4-2*pp ) )
279 qmax = z( 4*i0-pp-2 )
280 DO 70 i4 = 4*i0 - pp + 2, 4*n0 - pp - 2, 4
281 qmax = max( qmax, z( i4 ) )
293 DO 140 iwhila = 1, n + 1
308 IF( sigma.LT.zero )
THEN
318 emin = abs( z( 4*n0-5 ) )
324 DO 90 i4 = 4*n0, 8, -4
325 IF( z( i4-5 ).LE.zero )
327 IF( qmin.GE.four*emax )
THEN
328 qmin = min( qmin, z( i4-3 ) )
329 emax = max( emax, z( i4-5 ) )
331 qmax = max( qmax, z( i4-7 )+z( i4-5 ) )
332 emin = min( emin, z( i4-5 ) )
345 dmin = -max( zero, qmin-two*sqrt( qmin )*sqrt( emax ) )
351 nbig = 30*( n0-i0+1 )
352 DO 120 iwhilb = 1, nbig
358 CALL dlasq3( i0, n0, z, pp, dmin, sigma, desig, qmax, nfail,
365 IF( pp.EQ.0 .AND. n0-i0.GE.3 )
THEN
366 IF( z( 4*n0 ).LE.tol2*qmax .OR.
367 $ z( 4*n0-1 ).LE.tol2*sigma )
THEN
372 DO 110 i4 = 4*i0, 4*( n0-3 ), 4
373 IF( z( i4 ).LE.tol2*z( i4-3 ) .OR.
374 $ z( i4-1 ).LE.tol2*sigma )
THEN
381 qmax = max( qmax, z( i4+1 ) )
382 emin = min( emin, z( i4-1 ) )
383 oldemn = min( oldemn, z( i4 ) )
418 CALL dlasrt(
'D', n, z, iinfo )
429 z( 2*n+3 ) = dble( iter )
430 z( 2*n+4 ) = dble( ndiv ) / dble( n**2 )
431 z( 2*n+5 ) = hundrd*nfail / dble( iter )
subroutine dlasq2(N, Z, INFO)
subroutine dlasq3(I0, N0, Z, PP, DMIN, SIGMA, DESIG, QMAX, NFAIL, ITER, NDIV, IEEE)
subroutine dlasrt(ID, N, D, INFO)
subroutine xerbla(SRNAME, INFO)