1 *> \brief \b SLASQ5 computes one dqds transform in ping-pong form. Used by sbdsqr and sstegr.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SLASQ5 + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slasq5.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slasq5.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slasq5.f">
21 * SUBROUTINE SLASQ5( I0, N0, Z, PP, TAU, SIGMA, DMIN, DMIN1, DMIN2, DN,
22 * DNM1, DNM2, IEEE, EPS )
24 * .. Scalar Arguments ..
27 * REAL EPS, DMIN, DMIN1, DMIN2, DN, DNM1, DNM2, SIGMA, TAU
29 * .. Array Arguments ..
39 *> SLASQ5 computes one dqds transform in ping-pong form, one
40 *> version for IEEE machines another for non IEEE machines.
60 *> Z is REAL array, dimension ( 4*N )
61 *> Z holds the qd array. EMIN is stored in Z(4*N0) to avoid
68 *> PP=0 for ping, PP=1 for pong.
79 *> This is the accumulated shift up to this step.
85 *> Minimum value of d.
91 *> Minimum value of d, excluding D( N0 ).
97 *> Minimum value of d, excluding D( N0 ) and D( N0-1 ).
103 *> d(N0), the last value of d.
121 *> Flag for IEEE or non IEEE arithmetic.
127 *> This is the value of epsilon used.
133 *> \author Univ. of Tennessee
134 *> \author Univ. of California Berkeley
135 *> \author Univ. of Colorado Denver
138 *> \date November 2015
140 *> \ingroup auxOTHERcomputational
142 * =====================================================================
143 SUBROUTINE SLASQ5( I0, N0, Z, PP, TAU, SIGMA, DMIN, DMIN1, DMIN2,
144 $ DN, DNM1, DNM2, IEEE, EPS )
146 * -- LAPACK computational routine (version 3.6.0) --
147 * -- LAPACK is a software package provided by Univ. of Tennessee, --
148 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
151 * .. Scalar Arguments ..
154 REAL DMIN, DMIN1, DMIN2, DN, DNM1, DNM2, TAU,
157 * .. Array Arguments ..
161 * =====================================================================
165 PARAMETER ( ZERO = 0.0E0, HALF = 0.5 )
167 * .. Local Scalars ..
169 REAL D, EMIN, TEMP, DTHRESH
171 * .. Intrinsic Functions ..
174 * .. Executable Statements ..
176 IF( ( N0-I0-1 ).LE.0 )
179 DTHRESH = EPS*(SIGMA+TAU)
180 IF( TAU.LT.DTHRESH*HALF ) TAU = ZERO
181 IF( TAU.NE.ZERO ) THEN
190 * Code for IEEE arithmetic.
193 DO 10 J4 = 4*I0, 4*( N0-3 ), 4
194 Z( J4-2 ) = D + Z( J4-1 )
195 TEMP = Z( J4+1 ) / Z( J4-2 )
197 DMIN = MIN( DMIN, D )
198 Z( J4 ) = Z( J4-1 )*TEMP
199 EMIN = MIN( Z( J4 ), EMIN )
202 DO 20 J4 = 4*I0, 4*( N0-3 ), 4
203 Z( J4-3 ) = D + Z( J4 )
204 TEMP = Z( J4+2 ) / Z( J4-3 )
206 DMIN = MIN( DMIN, D )
207 Z( J4-1 ) = Z( J4 )*TEMP
208 EMIN = MIN( Z( J4-1 ), EMIN )
212 * Unroll last two steps.
218 Z( J4-2 ) = DNM2 + Z( J4P2 )
219 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
220 DNM1 = Z( J4P2+2 )*( DNM2 / Z( J4-2 ) ) - TAU
221 DMIN = MIN( DMIN, DNM1 )
226 Z( J4-2 ) = DNM1 + Z( J4P2 )
227 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
228 DN = Z( J4P2+2 )*( DNM1 / Z( J4-2 ) ) - TAU
229 DMIN = MIN( DMIN, DN )
233 * Code for non IEEE arithmetic.
236 DO 30 J4 = 4*I0, 4*( N0-3 ), 4
237 Z( J4-2 ) = D + Z( J4-1 )
241 Z( J4 ) = Z( J4+1 )*( Z( J4-1 ) / Z( J4-2 ) )
242 D = Z( J4+1 )*( D / Z( J4-2 ) ) - TAU
244 DMIN = MIN( DMIN, D )
245 EMIN = MIN( EMIN, Z( J4 ) )
248 DO 40 J4 = 4*I0, 4*( N0-3 ), 4
249 Z( J4-3 ) = D + Z( J4 )
253 Z( J4-1 ) = Z( J4+2 )*( Z( J4 ) / Z( J4-3 ) )
254 D = Z( J4+2 )*( D / Z( J4-3 ) ) - TAU
256 DMIN = MIN( DMIN, D )
257 EMIN = MIN( EMIN, Z( J4-1 ) )
261 * Unroll last two steps.
267 Z( J4-2 ) = DNM2 + Z( J4P2 )
268 IF( DNM2.LT.ZERO ) THEN
271 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
272 DNM1 = Z( J4P2+2 )*( DNM2 / Z( J4-2 ) ) - TAU
274 DMIN = MIN( DMIN, DNM1 )
279 Z( J4-2 ) = DNM1 + Z( J4P2 )
280 IF( DNM1.LT.ZERO ) THEN
283 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
284 DN = Z( J4P2+2 )*( DNM1 / Z( J4-2 ) ) - TAU
286 DMIN = MIN( DMIN, DN )
291 * This is the version that sets d's to zero if they are small enough
299 * Code for IEEE arithmetic.
302 DO 50 J4 = 4*I0, 4*( N0-3 ), 4
303 Z( J4-2 ) = D + Z( J4-1 )
304 TEMP = Z( J4+1 ) / Z( J4-2 )
306 IF( D.LT.DTHRESH ) D = ZERO
307 DMIN = MIN( DMIN, D )
308 Z( J4 ) = Z( J4-1 )*TEMP
309 EMIN = MIN( Z( J4 ), EMIN )
312 DO 60 J4 = 4*I0, 4*( N0-3 ), 4
313 Z( J4-3 ) = D + Z( J4 )
314 TEMP = Z( J4+2 ) / Z( J4-3 )
316 IF( D.LT.DTHRESH ) D = ZERO
317 DMIN = MIN( DMIN, D )
318 Z( J4-1 ) = Z( J4 )*TEMP
319 EMIN = MIN( Z( J4-1 ), EMIN )
323 * Unroll last two steps.
329 Z( J4-2 ) = DNM2 + Z( J4P2 )
330 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
331 DNM1 = Z( J4P2+2 )*( DNM2 / Z( J4-2 ) ) - TAU
332 DMIN = MIN( DMIN, DNM1 )
337 Z( J4-2 ) = DNM1 + Z( J4P2 )
338 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
339 DN = Z( J4P2+2 )*( DNM1 / Z( J4-2 ) ) - TAU
340 DMIN = MIN( DMIN, DN )
344 * Code for non IEEE arithmetic.
347 DO 70 J4 = 4*I0, 4*( N0-3 ), 4
348 Z( J4-2 ) = D + Z( J4-1 )
352 Z( J4 ) = Z( J4+1 )*( Z( J4-1 ) / Z( J4-2 ) )
353 D = Z( J4+1 )*( D / Z( J4-2 ) ) - TAU
355 IF( D.LT.DTHRESH ) D = ZERO
356 DMIN = MIN( DMIN, D )
357 EMIN = MIN( EMIN, Z( J4 ) )
360 DO 80 J4 = 4*I0, 4*( N0-3 ), 4
361 Z( J4-3 ) = D + Z( J4 )
365 Z( J4-1 ) = Z( J4+2 )*( Z( J4 ) / Z( J4-3 ) )
366 D = Z( J4+2 )*( D / Z( J4-3 ) ) - TAU
368 IF( D.LT.DTHRESH ) D = ZERO
369 DMIN = MIN( DMIN, D )
370 EMIN = MIN( EMIN, Z( J4-1 ) )
374 * Unroll last two steps.
380 Z( J4-2 ) = DNM2 + Z( J4P2 )
381 IF( DNM2.LT.ZERO ) THEN
384 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
385 DNM1 = Z( J4P2+2 )*( DNM2 / Z( J4-2 ) ) - TAU
387 DMIN = MIN( DMIN, DNM1 )
392 Z( J4-2 ) = DNM1 + Z( J4P2 )
393 IF( DNM1.LT.ZERO ) THEN
396 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
397 DN = Z( J4P2+2 )*( DNM1 / Z( J4-2 ) ) - TAU
399 DMIN = MIN( DMIN, DN )