LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
slasq5.f
Go to the documentation of this file.
1*> \brief <b> SLASQ5 computes one dqds transform in ping-pong form. Used by sbdsqr and sstegr. </b>
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> \htmlonly
9*> Download SLASQ5 + dependencies
10*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slasq5.f">
11*> [TGZ]</a>
12*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slasq5.f">
13*> [ZIP]</a>
14*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slasq5.f">
15*> [TXT]</a>
16*> \endhtmlonly
17*
18* Definition:
19* ===========
20*
21* SUBROUTINE SLASQ5( I0, N0, Z, PP, TAU, SIGMA, DMIN, DMIN1, DMIN2, DN,
22* DNM1, DNM2, IEEE, EPS )
23*
24* .. Scalar Arguments ..
25* LOGICAL IEEE
26* INTEGER I0, N0, PP
27* REAL EPS, DMIN, DMIN1, DMIN2, DN, DNM1, DNM2, SIGMA, TAU
28* ..
29* .. Array Arguments ..
30* REAL Z( * )
31* ..
32*
33*
34*> \par Purpose:
35* =============
36*>
37*> \verbatim
38*>
39*> SLASQ5 computes one dqds transform in ping-pong form, one
40*> version for IEEE machines another for non IEEE machines.
41*> \endverbatim
42*
43* Arguments:
44* ==========
45*
46*> \param[in] I0
47*> \verbatim
48*> I0 is INTEGER
49*> First index.
50*> \endverbatim
51*>
52*> \param[in] N0
53*> \verbatim
54*> N0 is INTEGER
55*> Last index.
56*> \endverbatim
57*>
58*> \param[in] Z
59*> \verbatim
60*> Z is REAL array, dimension ( 4*N )
61*> Z holds the qd array. EMIN is stored in Z(4*N0) to avoid
62*> an extra argument.
63*> \endverbatim
64*>
65*> \param[in] PP
66*> \verbatim
67*> PP is INTEGER
68*> PP=0 for ping, PP=1 for pong.
69*> \endverbatim
70*>
71*> \param[in] TAU
72*> \verbatim
73*> TAU is REAL
74*> This is the shift.
75*> \endverbatim
76*>
77*> \param[in] SIGMA
78*> \verbatim
79*> SIGMA is REAL
80*> This is the accumulated shift up to this step.
81*> \endverbatim
82*>
83*> \param[out] DMIN
84*> \verbatim
85*> DMIN is REAL
86*> Minimum value of d.
87*> \endverbatim
88*>
89*> \param[out] DMIN1
90*> \verbatim
91*> DMIN1 is REAL
92*> Minimum value of d, excluding D( N0 ).
93*> \endverbatim
94*>
95*> \param[out] DMIN2
96*> \verbatim
97*> DMIN2 is REAL
98*> Minimum value of d, excluding D( N0 ) and D( N0-1 ).
99*> \endverbatim
100*>
101*> \param[out] DN
102*> \verbatim
103*> DN is REAL
104*> d(N0), the last value of d.
105*> \endverbatim
106*>
107*> \param[out] DNM1
108*> \verbatim
109*> DNM1 is REAL
110*> d(N0-1).
111*> \endverbatim
112*>
113*> \param[out] DNM2
114*> \verbatim
115*> DNM2 is REAL
116*> d(N0-2).
117*> \endverbatim
118*>
119*> \param[in] IEEE
120*> \verbatim
121*> IEEE is LOGICAL
122*> Flag for IEEE or non IEEE arithmetic.
123*> \endverbatim
124*>
125*> \param[in] EPS
126*> \verbatim
127*> EPS is REAL
128*> This is the value of epsilon used.
129*> \endverbatim
130*
131* Authors:
132* ========
133*
134*> \author Univ. of Tennessee
135*> \author Univ. of California Berkeley
136*> \author Univ. of Colorado Denver
137*> \author NAG Ltd.
138*
139*> \ingroup lasq5
140*
141* =====================================================================
142 SUBROUTINE slasq5( I0, N0, Z, PP, TAU, SIGMA, DMIN, DMIN1, DMIN2,
143 $ DN, DNM1, DNM2, IEEE, EPS )
144*
145* -- LAPACK computational routine --
146* -- LAPACK is a software package provided by Univ. of Tennessee, --
147* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
148*
149* .. Scalar Arguments ..
150 LOGICAL IEEE
151 INTEGER I0, N0, PP
152 REAL DMIN, DMIN1, DMIN2, DN, DNM1, DNM2, TAU,
153 $ sigma, eps
154* ..
155* .. Array Arguments ..
156 REAL Z( * )
157* ..
158*
159* =====================================================================
160*
161* .. Parameter ..
162 REAL ZERO, HALF
163 parameter( zero = 0.0e0, half = 0.5 )
164* ..
165* .. Local Scalars ..
166 INTEGER J4, J4P2
167 REAL D, EMIN, TEMP, DTHRESH
168* ..
169* .. Intrinsic Functions ..
170 INTRINSIC min
171* ..
172* .. Executable Statements ..
173*
174 IF( ( n0-i0-1 ).LE.0 )
175 $ RETURN
176*
177 dthresh = eps*(sigma+tau)
178 IF( tau.LT.dthresh*half ) tau = zero
179 IF( tau.NE.zero ) THEN
180 j4 = 4*i0 + pp - 3
181 emin = z( j4+4 )
182 d = z( j4 ) - tau
183 dmin = d
184 dmin1 = -z( j4 )
185*
186 IF( ieee ) THEN
187*
188* Code for IEEE arithmetic.
189*
190 IF( pp.EQ.0 ) THEN
191 DO 10 j4 = 4*i0, 4*( n0-3 ), 4
192 z( j4-2 ) = d + z( j4-1 )
193 temp = z( j4+1 ) / z( j4-2 )
194 d = d*temp - tau
195 dmin = min( dmin, d )
196 z( j4 ) = z( j4-1 )*temp
197 emin = min( z( j4 ), emin )
198 10 CONTINUE
199 ELSE
200 DO 20 j4 = 4*i0, 4*( n0-3 ), 4
201 z( j4-3 ) = d + z( j4 )
202 temp = z( j4+2 ) / z( j4-3 )
203 d = d*temp - tau
204 dmin = min( dmin, d )
205 z( j4-1 ) = z( j4 )*temp
206 emin = min( z( j4-1 ), emin )
207 20 CONTINUE
208 END IF
209*
210* Unroll last two steps.
211*
212 dnm2 = d
213 dmin2 = dmin
214 j4 = 4*( n0-2 ) - pp
215 j4p2 = j4 + 2*pp - 1
216 z( j4-2 ) = dnm2 + z( j4p2 )
217 z( j4 ) = z( j4p2+2 )*( z( j4p2 ) / z( j4-2 ) )
218 dnm1 = z( j4p2+2 )*( dnm2 / z( j4-2 ) ) - tau
219 dmin = min( dmin, dnm1 )
220*
221 dmin1 = dmin
222 j4 = j4 + 4
223 j4p2 = j4 + 2*pp - 1
224 z( j4-2 ) = dnm1 + z( j4p2 )
225 z( j4 ) = z( j4p2+2 )*( z( j4p2 ) / z( j4-2 ) )
226 dn = z( j4p2+2 )*( dnm1 / z( j4-2 ) ) - tau
227 dmin = min( dmin, dn )
228*
229 ELSE
230*
231* Code for non IEEE arithmetic.
232*
233 IF( pp.EQ.0 ) THEN
234 DO 30 j4 = 4*i0, 4*( n0-3 ), 4
235 z( j4-2 ) = d + z( j4-1 )
236 IF( d.LT.zero ) THEN
237 RETURN
238 ELSE
239 z( j4 ) = z( j4+1 )*( z( j4-1 ) / z( j4-2 ) )
240 d = z( j4+1 )*( d / z( j4-2 ) ) - tau
241 END IF
242 dmin = min( dmin, d )
243 emin = min( emin, z( j4 ) )
244 30 CONTINUE
245 ELSE
246 DO 40 j4 = 4*i0, 4*( n0-3 ), 4
247 z( j4-3 ) = d + z( j4 )
248 IF( d.LT.zero ) THEN
249 RETURN
250 ELSE
251 z( j4-1 ) = z( j4+2 )*( z( j4 ) / z( j4-3 ) )
252 d = z( j4+2 )*( d / z( j4-3 ) ) - tau
253 END IF
254 dmin = min( dmin, d )
255 emin = min( emin, z( j4-1 ) )
256 40 CONTINUE
257 END IF
258*
259* Unroll last two steps.
260*
261 dnm2 = d
262 dmin2 = dmin
263 j4 = 4*( n0-2 ) - pp
264 j4p2 = j4 + 2*pp - 1
265 z( j4-2 ) = dnm2 + z( j4p2 )
266 IF( dnm2.LT.zero ) THEN
267 RETURN
268 ELSE
269 z( j4 ) = z( j4p2+2 )*( z( j4p2 ) / z( j4-2 ) )
270 dnm1 = z( j4p2+2 )*( dnm2 / z( j4-2 ) ) - tau
271 END IF
272 dmin = min( dmin, dnm1 )
273*
274 dmin1 = dmin
275 j4 = j4 + 4
276 j4p2 = j4 + 2*pp - 1
277 z( j4-2 ) = dnm1 + z( j4p2 )
278 IF( dnm1.LT.zero ) THEN
279 RETURN
280 ELSE
281 z( j4 ) = z( j4p2+2 )*( z( j4p2 ) / z( j4-2 ) )
282 dn = z( j4p2+2 )*( dnm1 / z( j4-2 ) ) - tau
283 END IF
284 dmin = min( dmin, dn )
285*
286 END IF
287*
288 ELSE
289* This is the version that sets d's to zero if they are small enough
290 j4 = 4*i0 + pp - 3
291 emin = z( j4+4 )
292 d = z( j4 ) - tau
293 dmin = d
294 dmin1 = -z( j4 )
295 IF( ieee ) THEN
296*
297* Code for IEEE arithmetic.
298*
299 IF( pp.EQ.0 ) THEN
300 DO 50 j4 = 4*i0, 4*( n0-3 ), 4
301 z( j4-2 ) = d + z( j4-1 )
302 temp = z( j4+1 ) / z( j4-2 )
303 d = d*temp - tau
304 IF( d.LT.dthresh ) d = zero
305 dmin = min( dmin, d )
306 z( j4 ) = z( j4-1 )*temp
307 emin = min( z( j4 ), emin )
308 50 CONTINUE
309 ELSE
310 DO 60 j4 = 4*i0, 4*( n0-3 ), 4
311 z( j4-3 ) = d + z( j4 )
312 temp = z( j4+2 ) / z( j4-3 )
313 d = d*temp - tau
314 IF( d.LT.dthresh ) d = zero
315 dmin = min( dmin, d )
316 z( j4-1 ) = z( j4 )*temp
317 emin = min( z( j4-1 ), emin )
318 60 CONTINUE
319 END IF
320*
321* Unroll last two steps.
322*
323 dnm2 = d
324 dmin2 = dmin
325 j4 = 4*( n0-2 ) - pp
326 j4p2 = j4 + 2*pp - 1
327 z( j4-2 ) = dnm2 + z( j4p2 )
328 z( j4 ) = z( j4p2+2 )*( z( j4p2 ) / z( j4-2 ) )
329 dnm1 = z( j4p2+2 )*( dnm2 / z( j4-2 ) ) - tau
330 dmin = min( dmin, dnm1 )
331*
332 dmin1 = dmin
333 j4 = j4 + 4
334 j4p2 = j4 + 2*pp - 1
335 z( j4-2 ) = dnm1 + z( j4p2 )
336 z( j4 ) = z( j4p2+2 )*( z( j4p2 ) / z( j4-2 ) )
337 dn = z( j4p2+2 )*( dnm1 / z( j4-2 ) ) - tau
338 dmin = min( dmin, dn )
339*
340 ELSE
341*
342* Code for non IEEE arithmetic.
343*
344 IF( pp.EQ.0 ) THEN
345 DO 70 j4 = 4*i0, 4*( n0-3 ), 4
346 z( j4-2 ) = d + z( j4-1 )
347 IF( d.LT.zero ) THEN
348 RETURN
349 ELSE
350 z( j4 ) = z( j4+1 )*( z( j4-1 ) / z( j4-2 ) )
351 d = z( j4+1 )*( d / z( j4-2 ) ) - tau
352 END IF
353 IF( d.LT.dthresh ) d = zero
354 dmin = min( dmin, d )
355 emin = min( emin, z( j4 ) )
356 70 CONTINUE
357 ELSE
358 DO 80 j4 = 4*i0, 4*( n0-3 ), 4
359 z( j4-3 ) = d + z( j4 )
360 IF( d.LT.zero ) THEN
361 RETURN
362 ELSE
363 z( j4-1 ) = z( j4+2 )*( z( j4 ) / z( j4-3 ) )
364 d = z( j4+2 )*( d / z( j4-3 ) ) - tau
365 END IF
366 IF( d.LT.dthresh ) d = zero
367 dmin = min( dmin, d )
368 emin = min( emin, z( j4-1 ) )
369 80 CONTINUE
370 END IF
371*
372* Unroll last two steps.
373*
374 dnm2 = d
375 dmin2 = dmin
376 j4 = 4*( n0-2 ) - pp
377 j4p2 = j4 + 2*pp - 1
378 z( j4-2 ) = dnm2 + z( j4p2 )
379 IF( dnm2.LT.zero ) THEN
380 RETURN
381 ELSE
382 z( j4 ) = z( j4p2+2 )*( z( j4p2 ) / z( j4-2 ) )
383 dnm1 = z( j4p2+2 )*( dnm2 / z( j4-2 ) ) - tau
384 END IF
385 dmin = min( dmin, dnm1 )
386*
387 dmin1 = dmin
388 j4 = j4 + 4
389 j4p2 = j4 + 2*pp - 1
390 z( j4-2 ) = dnm1 + z( j4p2 )
391 IF( dnm1.LT.zero ) THEN
392 RETURN
393 ELSE
394 z( j4 ) = z( j4p2+2 )*( z( j4p2 ) / z( j4-2 ) )
395 dn = z( j4p2+2 )*( dnm1 / z( j4-2 ) ) - tau
396 END IF
397 dmin = min( dmin, dn )
398*
399 END IF
400*
401 END IF
402 z( j4+2 ) = dn
403 z( 4*n0-pp ) = emin
404 RETURN
405*
406* End of SLASQ5
407*
408 END
subroutine slasq5(i0, n0, z, pp, tau, sigma, dmin, dmin1, dmin2, dn, dnm1, dnm2, ieee, eps)
SLASQ5 computes one dqds transform in ping-pong form. Used by sbdsqr and sstegr.
Definition slasq5.f:144