1 *> \brief <b> SLASQ5 computes one dqds transform in ping-pong form. Used by sbdsqr and sstegr. </b>
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.
80 *> This is the accumulated shift up to this step.
86 *> Minimum value of d.
92 *> Minimum value of d, excluding D( N0 ).
98 *> Minimum value of d, excluding D( N0 ) and D( N0-1 ).
104 *> d(N0), the last value of d.
122 *> Flag for IEEE or non IEEE arithmetic.
128 *> This is the value of epsilon used.
134 *> \author Univ. of Tennessee
135 *> \author Univ. of California Berkeley
136 *> \author Univ. of Colorado Denver
139 *> \date November 2015
141 *> \ingroup auxOTHERcomputational
143 * =====================================================================
144 SUBROUTINE SLASQ5( I0, N0, Z, PP, TAU, SIGMA, DMIN, DMIN1, DMIN2,
145 $ DN, DNM1, DNM2, IEEE, EPS )
147 * -- LAPACK computational routine (version 3.6.0) --
148 * -- LAPACK is a software package provided by Univ. of Tennessee, --
149 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
152 * .. Scalar Arguments ..
155 REAL DMIN, DMIN1, DMIN2, DN, DNM1, DNM2, TAU,
158 * .. Array Arguments ..
162 * =====================================================================
166 PARAMETER ( ZERO = 0.0E0, HALF = 0.5 )
168 * .. Local Scalars ..
170 REAL D, EMIN, TEMP, DTHRESH
172 * .. Intrinsic Functions ..
175 * .. Executable Statements ..
177 IF( ( N0-I0-1 ).LE.0 )
180 DTHRESH = EPS*(SIGMA+TAU)
181 IF( TAU.LT.DTHRESH*HALF ) TAU = ZERO
182 IF( TAU.NE.ZERO ) THEN
191 * Code for IEEE arithmetic.
194 DO 10 J4 = 4*I0, 4*( N0-3 ), 4
195 Z( J4-2 ) = D + Z( J4-1 )
196 TEMP = Z( J4+1 ) / Z( J4-2 )
198 DMIN = MIN( DMIN, D )
199 Z( J4 ) = Z( J4-1 )*TEMP
200 EMIN = MIN( Z( J4 ), EMIN )
203 DO 20 J4 = 4*I0, 4*( N0-3 ), 4
204 Z( J4-3 ) = D + Z( J4 )
205 TEMP = Z( J4+2 ) / Z( J4-3 )
207 DMIN = MIN( DMIN, D )
208 Z( J4-1 ) = Z( J4 )*TEMP
209 EMIN = MIN( Z( J4-1 ), EMIN )
213 * Unroll last two steps.
219 Z( J4-2 ) = DNM2 + Z( J4P2 )
220 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
221 DNM1 = Z( J4P2+2 )*( DNM2 / Z( J4-2 ) ) - TAU
222 DMIN = MIN( DMIN, DNM1 )
227 Z( J4-2 ) = DNM1 + Z( J4P2 )
228 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
229 DN = Z( J4P2+2 )*( DNM1 / Z( J4-2 ) ) - TAU
230 DMIN = MIN( DMIN, DN )
234 * Code for non IEEE arithmetic.
237 DO 30 J4 = 4*I0, 4*( N0-3 ), 4
238 Z( J4-2 ) = D + Z( J4-1 )
242 Z( J4 ) = Z( J4+1 )*( Z( J4-1 ) / Z( J4-2 ) )
243 D = Z( J4+1 )*( D / Z( J4-2 ) ) - TAU
245 DMIN = MIN( DMIN, D )
246 EMIN = MIN( EMIN, Z( J4 ) )
249 DO 40 J4 = 4*I0, 4*( N0-3 ), 4
250 Z( J4-3 ) = D + Z( J4 )
254 Z( J4-1 ) = Z( J4+2 )*( Z( J4 ) / Z( J4-3 ) )
255 D = Z( J4+2 )*( D / Z( J4-3 ) ) - TAU
257 DMIN = MIN( DMIN, D )
258 EMIN = MIN( EMIN, Z( J4-1 ) )
262 * Unroll last two steps.
268 Z( J4-2 ) = DNM2 + Z( J4P2 )
269 IF( DNM2.LT.ZERO ) THEN
272 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
273 DNM1 = Z( J4P2+2 )*( DNM2 / Z( J4-2 ) ) - TAU
275 DMIN = MIN( DMIN, DNM1 )
280 Z( J4-2 ) = DNM1 + Z( J4P2 )
281 IF( DNM1.LT.ZERO ) THEN
284 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
285 DN = Z( J4P2+2 )*( DNM1 / Z( J4-2 ) ) - TAU
287 DMIN = MIN( DMIN, DN )
292 * This is the version that sets d's to zero if they are small enough
300 * Code for IEEE arithmetic.
303 DO 50 J4 = 4*I0, 4*( N0-3 ), 4
304 Z( J4-2 ) = D + Z( J4-1 )
305 TEMP = Z( J4+1 ) / Z( J4-2 )
307 IF( D.LT.DTHRESH ) D = ZERO
308 DMIN = MIN( DMIN, D )
309 Z( J4 ) = Z( J4-1 )*TEMP
310 EMIN = MIN( Z( J4 ), EMIN )
313 DO 60 J4 = 4*I0, 4*( N0-3 ), 4
314 Z( J4-3 ) = D + Z( J4 )
315 TEMP = Z( J4+2 ) / Z( J4-3 )
317 IF( D.LT.DTHRESH ) D = ZERO
318 DMIN = MIN( DMIN, D )
319 Z( J4-1 ) = Z( J4 )*TEMP
320 EMIN = MIN( Z( J4-1 ), EMIN )
324 * Unroll last two steps.
330 Z( J4-2 ) = DNM2 + Z( J4P2 )
331 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
332 DNM1 = Z( J4P2+2 )*( DNM2 / Z( J4-2 ) ) - TAU
333 DMIN = MIN( DMIN, DNM1 )
338 Z( J4-2 ) = DNM1 + Z( J4P2 )
339 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
340 DN = Z( J4P2+2 )*( DNM1 / Z( J4-2 ) ) - TAU
341 DMIN = MIN( DMIN, DN )
345 * Code for non IEEE arithmetic.
348 DO 70 J4 = 4*I0, 4*( N0-3 ), 4
349 Z( J4-2 ) = D + Z( J4-1 )
353 Z( J4 ) = Z( J4+1 )*( Z( J4-1 ) / Z( J4-2 ) )
354 D = Z( J4+1 )*( D / Z( J4-2 ) ) - TAU
356 IF( D.LT.DTHRESH ) D = ZERO
357 DMIN = MIN( DMIN, D )
358 EMIN = MIN( EMIN, Z( J4 ) )
361 DO 80 J4 = 4*I0, 4*( N0-3 ), 4
362 Z( J4-3 ) = D + Z( J4 )
366 Z( J4-1 ) = Z( J4+2 )*( Z( J4 ) / Z( J4-3 ) )
367 D = Z( J4+2 )*( D / Z( J4-3 ) ) - TAU
369 IF( D.LT.DTHRESH ) D = ZERO
370 DMIN = MIN( DMIN, D )
371 EMIN = MIN( EMIN, Z( J4-1 ) )
375 * Unroll last two steps.
381 Z( J4-2 ) = DNM2 + Z( J4P2 )
382 IF( DNM2.LT.ZERO ) THEN
385 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
386 DNM1 = Z( J4P2+2 )*( DNM2 / Z( J4-2 ) ) - TAU
388 DMIN = MIN( DMIN, DNM1 )
393 Z( J4-2 ) = DNM1 + Z( J4P2 )
394 IF( DNM1.LT.ZERO ) THEN
397 Z( J4 ) = Z( J4P2+2 )*( Z( J4P2 ) / Z( J4-2 ) )
398 DN = Z( J4P2+2 )*( DNM1 / Z( J4-2 ) ) - TAU
400 DMIN = MIN( DMIN, DN )