LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dlasq6.f
Go to the documentation of this file.
1*> \brief \b DLASQ6 computes one dqd transform in ping-pong form. Used by sbdsqr and sstegr.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download DLASQ6 + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlasq6.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlasq6.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlasq6.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE DLASQ6( I0, N0, Z, PP, DMIN, DMIN1, DMIN2, DN,
20* DNM1, DNM2 )
21*
22* .. Scalar Arguments ..
23* INTEGER I0, N0, PP
24* DOUBLE PRECISION DMIN, DMIN1, DMIN2, DN, DNM1, DNM2
25* ..
26* .. Array Arguments ..
27* DOUBLE PRECISION Z( * )
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*> \verbatim
35*>
36*> DLASQ6 computes one dqd (shift equal to zero) transform in
37*> ping-pong form, with protection against underflow and overflow.
38*> \endverbatim
39*
40* Arguments:
41* ==========
42*
43*> \param[in] I0
44*> \verbatim
45*> I0 is INTEGER
46*> First index.
47*> \endverbatim
48*>
49*> \param[in] N0
50*> \verbatim
51*> N0 is INTEGER
52*> Last index.
53*> \endverbatim
54*>
55*> \param[in] Z
56*> \verbatim
57*> Z is DOUBLE PRECISION array, dimension ( 4*N )
58*> Z holds the qd array. EMIN is stored in Z(4*N0) to avoid
59*> an extra argument.
60*> \endverbatim
61*>
62*> \param[in] PP
63*> \verbatim
64*> PP is INTEGER
65*> PP=0 for ping, PP=1 for pong.
66*> \endverbatim
67*>
68*> \param[out] DMIN
69*> \verbatim
70*> DMIN is DOUBLE PRECISION
71*> Minimum value of d.
72*> \endverbatim
73*>
74*> \param[out] DMIN1
75*> \verbatim
76*> DMIN1 is DOUBLE PRECISION
77*> Minimum value of d, excluding D( N0 ).
78*> \endverbatim
79*>
80*> \param[out] DMIN2
81*> \verbatim
82*> DMIN2 is DOUBLE PRECISION
83*> Minimum value of d, excluding D( N0 ) and D( N0-1 ).
84*> \endverbatim
85*>
86*> \param[out] DN
87*> \verbatim
88*> DN is DOUBLE PRECISION
89*> d(N0), the last value of d.
90*> \endverbatim
91*>
92*> \param[out] DNM1
93*> \verbatim
94*> DNM1 is DOUBLE PRECISION
95*> d(N0-1).
96*> \endverbatim
97*>
98*> \param[out] DNM2
99*> \verbatim
100*> DNM2 is DOUBLE PRECISION
101*> d(N0-2).
102*> \endverbatim
103*
104* Authors:
105* ========
106*
107*> \author Univ. of Tennessee
108*> \author Univ. of California Berkeley
109*> \author Univ. of Colorado Denver
110*> \author NAG Ltd.
111*
112*> \ingroup lasq6
113*
114* =====================================================================
115 SUBROUTINE dlasq6( I0, N0, Z, PP, DMIN, DMIN1, DMIN2, DN,
116 $ DNM1, DNM2 )
117*
118* -- LAPACK computational routine --
119* -- LAPACK is a software package provided by Univ. of Tennessee, --
120* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
121*
122* .. Scalar Arguments ..
123 INTEGER I0, N0, PP
124 DOUBLE PRECISION DMIN, DMIN1, DMIN2, DN, DNM1, DNM2
125* ..
126* .. Array Arguments ..
127 DOUBLE PRECISION Z( * )
128* ..
129*
130* =====================================================================
131*
132* .. Parameter ..
133 DOUBLE PRECISION ZERO
134 parameter( zero = 0.0d0 )
135* ..
136* .. Local Scalars ..
137 INTEGER J4, J4P2
138 DOUBLE PRECISION D, EMIN, SAFMIN, TEMP
139* ..
140* .. External Function ..
141 DOUBLE PRECISION DLAMCH
142 EXTERNAL dlamch
143* ..
144* .. Intrinsic Functions ..
145 INTRINSIC min
146* ..
147* .. Executable Statements ..
148*
149 IF( ( n0-i0-1 ).LE.0 )
150 $ RETURN
151*
152 safmin = dlamch( 'Safe minimum' )
153 j4 = 4*i0 + pp - 3
154 emin = z( j4+4 )
155 d = z( j4 )
156 dmin = d
157*
158 IF( pp.EQ.0 ) THEN
159 DO 10 j4 = 4*i0, 4*( n0-3 ), 4
160 z( j4-2 ) = d + z( j4-1 )
161 IF( z( j4-2 ).EQ.zero ) THEN
162 z( j4 ) = zero
163 d = z( j4+1 )
164 dmin = d
165 emin = zero
166 ELSE IF( safmin*z( j4+1 ).LT.z( j4-2 ) .AND.
167 $ safmin*z( j4-2 ).LT.z( j4+1 ) ) THEN
168 temp = z( j4+1 ) / z( j4-2 )
169 z( j4 ) = z( j4-1 )*temp
170 d = d*temp
171 ELSE
172 z( j4 ) = z( j4+1 )*( z( j4-1 ) / z( j4-2 ) )
173 d = z( j4+1 )*( d / z( j4-2 ) )
174 END IF
175 dmin = min( dmin, d )
176 emin = min( emin, z( j4 ) )
177 10 CONTINUE
178 ELSE
179 DO 20 j4 = 4*i0, 4*( n0-3 ), 4
180 z( j4-3 ) = d + z( j4 )
181 IF( z( j4-3 ).EQ.zero ) THEN
182 z( j4-1 ) = zero
183 d = z( j4+2 )
184 dmin = d
185 emin = zero
186 ELSE IF( safmin*z( j4+2 ).LT.z( j4-3 ) .AND.
187 $ safmin*z( j4-3 ).LT.z( j4+2 ) ) THEN
188 temp = z( j4+2 ) / z( j4-3 )
189 z( j4-1 ) = z( j4 )*temp
190 d = d*temp
191 ELSE
192 z( j4-1 ) = z( j4+2 )*( z( j4 ) / z( j4-3 ) )
193 d = z( j4+2 )*( d / z( j4-3 ) )
194 END IF
195 dmin = min( dmin, d )
196 emin = min( emin, z( j4-1 ) )
197 20 CONTINUE
198 END IF
199*
200* Unroll last two steps.
201*
202 dnm2 = d
203 dmin2 = dmin
204 j4 = 4*( n0-2 ) - pp
205 j4p2 = j4 + 2*pp - 1
206 z( j4-2 ) = dnm2 + z( j4p2 )
207 IF( z( j4-2 ).EQ.zero ) THEN
208 z( j4 ) = zero
209 dnm1 = z( j4p2+2 )
210 dmin = dnm1
211 emin = zero
212 ELSE IF( safmin*z( j4p2+2 ).LT.z( j4-2 ) .AND.
213 $ safmin*z( j4-2 ).LT.z( j4p2+2 ) ) THEN
214 temp = z( j4p2+2 ) / z( j4-2 )
215 z( j4 ) = z( j4p2 )*temp
216 dnm1 = dnm2*temp
217 ELSE
218 z( j4 ) = z( j4p2+2 )*( z( j4p2 ) / z( j4-2 ) )
219 dnm1 = z( j4p2+2 )*( dnm2 / z( j4-2 ) )
220 END IF
221 dmin = min( dmin, dnm1 )
222*
223 dmin1 = dmin
224 j4 = j4 + 4
225 j4p2 = j4 + 2*pp - 1
226 z( j4-2 ) = dnm1 + z( j4p2 )
227 IF( z( j4-2 ).EQ.zero ) THEN
228 z( j4 ) = zero
229 dn = z( j4p2+2 )
230 dmin = dn
231 emin = zero
232 ELSE IF( safmin*z( j4p2+2 ).LT.z( j4-2 ) .AND.
233 $ safmin*z( j4-2 ).LT.z( j4p2+2 ) ) THEN
234 temp = z( j4p2+2 ) / z( j4-2 )
235 z( j4 ) = z( j4p2 )*temp
236 dn = dnm1*temp
237 ELSE
238 z( j4 ) = z( j4p2+2 )*( z( j4p2 ) / z( j4-2 ) )
239 dn = z( j4p2+2 )*( dnm1 / z( j4-2 ) )
240 END IF
241 dmin = min( dmin, dn )
242*
243 z( j4+2 ) = dn
244 z( 4*n0-pp ) = emin
245 RETURN
246*
247* End of DLASQ6
248*
249 END
subroutine dlasq6(i0, n0, z, pp, dmin, dmin1, dmin2, dn, dnm1, dnm2)
DLASQ6 computes one dqd transform in ping-pong form. Used by sbdsqr and sstegr.
Definition dlasq6.f:117