KTH framework for Nek5000 toolboxes; testing version  0.0.1
dlasq6.f
Go to the documentation of this file.
1  SUBROUTINE dlasq6( I0, N0, Z, PP, DMIN, DMIN1, DMIN2, DN,
2  $ DNM1, DNM2 )
3 *
4 * -- LAPACK auxiliary routine (version 3.0) --
5 * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
6 * Courant Institute, Argonne National Lab, and Rice University
7 * October 31, 1999
8 *
9 * .. Scalar Arguments ..
10  INTEGER I0, N0, PP
11  DOUBLE PRECISION DMIN, DMIN1, DMIN2, DN, DNM1, DNM2
12 * ..
13 * .. Array Arguments ..
14  DOUBLE PRECISION Z( * )
15 * ..
16 *
17 * Purpose
18 * =======
19 *
20 * DLASQ6 computes one dqd (shift equal to zero) transform in
21 * ping-pong form, with protection against underflow and overflow.
22 *
23 * Arguments
24 * =========
25 *
26 * I0 (input) INTEGER
27 * First index.
28 *
29 * N0 (input) INTEGER
30 * Last index.
31 *
32 * Z (input) DOUBLE PRECISION array, dimension ( 4*N )
33 * Z holds the qd array. EMIN is stored in Z(4*N0) to avoid
34 * an extra argument.
35 *
36 * PP (input) INTEGER
37 * PP=0 for ping, PP=1 for pong.
38 *
39 * DMIN (output) DOUBLE PRECISION
40 * Minimum value of d.
41 *
42 * DMIN1 (output) DOUBLE PRECISION
43 * Minimum value of d, excluding D( N0 ).
44 *
45 * DMIN2 (output) DOUBLE PRECISION
46 * Minimum value of d, excluding D( N0 ) and D( N0-1 ).
47 *
48 * DN (output) DOUBLE PRECISION
49 * d(N0), the last value of d.
50 *
51 * DNM1 (output) DOUBLE PRECISION
52 * d(N0-1).
53 *
54 * DNM2 (output) DOUBLE PRECISION
55 * d(N0-2).
56 *
57 * =====================================================================
58 *
59 * .. Parameter ..
60  DOUBLE PRECISION ZERO
61  parameter( zero = 0.0d0 )
62 * ..
63 * .. Local Scalars ..
64  INTEGER J4, J4P2
65  DOUBLE PRECISION D, EMIN, SAFMIN, TEMP
66 * ..
67 * .. External Function ..
68  DOUBLE PRECISION DLAMCH
69  EXTERNAL dlamch
70 * ..
71 * .. Intrinsic Functions ..
72  INTRINSIC min
73 * ..
74 * .. Executable Statements ..
75 *
76  IF( ( n0-i0-1 ).LE.0 )
77  $ RETURN
78 *
79  safmin = dlamch( 'Safe minimum' )
80  j4 = 4*i0 + pp - 3
81  emin = z( j4+4 )
82  d = z( j4 )
83  dmin = d
84 *
85  IF( pp.EQ.0 ) THEN
86  DO 10 j4 = 4*i0, 4*( n0-3 ), 4
87  z( j4-2 ) = d + z( j4-1 )
88  IF( z( j4-2 ).EQ.zero ) THEN
89  z( j4 ) = zero
90  d = z( j4+1 )
91  dmin = d
92  emin = zero
93  ELSE IF( safmin*z( j4+1 ).LT.z( j4-2 ) .AND.
94  $ safmin*z( j4-2 ).LT.z( j4+1 ) ) THEN
95  temp = z( j4+1 ) / z( j4-2 )
96  z( j4 ) = z( j4-1 )*temp
97  d = d*temp
98  ELSE
99  z( j4 ) = z( j4+1 )*( z( j4-1 ) / z( j4-2 ) )
100  d = z( j4+1 )*( d / z( j4-2 ) )
101  END IF
102  dmin = min( dmin, d )
103  emin = min( emin, z( j4 ) )
104  10 CONTINUE
105  ELSE
106  DO 20 j4 = 4*i0, 4*( n0-3 ), 4
107  z( j4-3 ) = d + z( j4 )
108  IF( z( j4-3 ).EQ.zero ) THEN
109  z( j4-1 ) = zero
110  d = z( j4+2 )
111  dmin = d
112  emin = zero
113  ELSE IF( safmin*z( j4+2 ).LT.z( j4-3 ) .AND.
114  $ safmin*z( j4-3 ).LT.z( j4+2 ) ) THEN
115  temp = z( j4+2 ) / z( j4-3 )
116  z( j4-1 ) = z( j4 )*temp
117  d = d*temp
118  ELSE
119  z( j4-1 ) = z( j4+2 )*( z( j4 ) / z( j4-3 ) )
120  d = z( j4+2 )*( d / z( j4-3 ) )
121  END IF
122  dmin = min( dmin, d )
123  emin = min( emin, z( j4-1 ) )
124  20 CONTINUE
125  END IF
126 *
127 * Unroll last two steps.
128 *
129  dnm2 = d
130  dmin2 = dmin
131  j4 = 4*( n0-2 ) - pp
132  j4p2 = j4 + 2*pp - 1
133  z( j4-2 ) = dnm2 + z( j4p2 )
134  IF( z( j4-2 ).EQ.zero ) THEN
135  z( j4 ) = zero
136  dnm1 = z( j4p2+2 )
137  dmin = dnm1
138  emin = zero
139  ELSE IF( safmin*z( j4p2+2 ).LT.z( j4-2 ) .AND.
140  $ safmin*z( j4-2 ).LT.z( j4p2+2 ) ) THEN
141  temp = z( j4p2+2 ) / z( j4-2 )
142  z( j4 ) = z( j4p2 )*temp
143  dnm1 = dnm2*temp
144  ELSE
145  z( j4 ) = z( j4p2+2 )*( z( j4p2 ) / z( j4-2 ) )
146  dnm1 = z( j4p2+2 )*( dnm2 / z( j4-2 ) )
147  END IF
148  dmin = min( dmin, dnm1 )
149 *
150  dmin1 = dmin
151  j4 = j4 + 4
152  j4p2 = j4 + 2*pp - 1
153  z( j4-2 ) = dnm1 + z( j4p2 )
154  IF( z( j4-2 ).EQ.zero ) THEN
155  z( j4 ) = zero
156  dn = z( j4p2+2 )
157  dmin = dn
158  emin = zero
159  ELSE IF( safmin*z( j4p2+2 ).LT.z( j4-2 ) .AND.
160  $ safmin*z( j4-2 ).LT.z( j4p2+2 ) ) THEN
161  temp = z( j4p2+2 ) / z( j4-2 )
162  z( j4 ) = z( j4p2 )*temp
163  dn = dnm1*temp
164  ELSE
165  z( j4 ) = z( j4p2+2 )*( z( j4p2 ) / z( j4-2 ) )
166  dn = z( j4p2+2 )*( dnm1 / z( j4-2 ) )
167  END IF
168  dmin = min( dmin, dn )
169 *
170  z( j4+2 ) = dn
171  z( 4*n0-pp ) = emin
172  RETURN
173 *
174 * End of DLASQ6
175 *
176  END
subroutine dlasq6(I0, N0, Z, PP, DMIN, DMIN1, DMIN2, DN, DNM1, DNM2)
Definition: dlasq6.f:3