1      PROGRAM DBLAT1
2*     Test program for the DOUBLE PRECISION Level 1 BLAS.
3*     Based upon the original BLAS test routine together with:
4*     F06EAF Example Program Text
5*     .. Parameters ..
6      INTEGER          NOUT
7      PARAMETER        (NOUT=6)
8*     .. Scalars in Common ..
9      INTEGER          ICASE, INCX, INCY, MODE, N
10      LOGICAL          PASS
11*     .. Local Scalars ..
12      DOUBLE PRECISION SFAC
13      INTEGER          IC
14*     .. External Subroutines ..
15      EXTERNAL         CHECK0, CHECK1, CHECK2, CHECK3, HEADER
16*     .. Common blocks ..
17      COMMON           /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
18*     .. Data statements ..
19      DATA             SFAC/9.765625D-4/
20*     .. Executable Statements ..
21      WRITE (NOUT,99999)
22      DO 20 IC = 1, 10
23         ICASE = IC
24         CALL HEADER
25*
26*        .. Initialize  PASS,  INCX,  INCY, and MODE for a new case. ..
27*        .. the value 9999 for INCX, INCY or MODE will appear in the ..
28*        .. detailed  output, if any, for cases  that do not involve ..
29*        .. these parameters ..
30*
31         PASS = .TRUE.
32         INCX = 9999
33         INCY = 9999
34         MODE = 9999
35         IF (ICASE.EQ.3) THEN
36            CALL CHECK0(SFAC)
37         ELSE IF (ICASE.EQ.7 .OR. ICASE.EQ.8 .OR. ICASE.EQ.9 .OR.
38     +            ICASE.EQ.10) THEN
39            CALL CHECK1(SFAC)
40         ELSE IF (ICASE.EQ.1 .OR. ICASE.EQ.2 .OR. ICASE.EQ.5 .OR.
41     +            ICASE.EQ.6) THEN
42            CALL CHECK2(SFAC)
43         ELSE IF (ICASE.EQ.4) THEN
44            CALL CHECK3(SFAC)
45         END IF
46*        -- Print
47         IF (PASS) WRITE (NOUT,99998)
48   20 CONTINUE
49      STOP
50*
5199999 FORMAT (' Real BLAS Test Program Results',/1X)
5299998 FORMAT ('                                    ----- PASS -----')
53      END
54      SUBROUTINE HEADER
55*     .. Parameters ..
56      INTEGER          NOUT
57      PARAMETER        (NOUT=6)
58*     .. Scalars in Common ..
59      INTEGER          ICASE, INCX, INCY, MODE, N
60      LOGICAL          PASS
61*     .. Local Arrays ..
62      CHARACTER*6      L(10)
63*     .. Common blocks ..
64      COMMON           /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
65*     .. Data statements ..
66      DATA             L(1)/' DDOT '/
67      DATA             L(2)/'DAXPY '/
68      DATA             L(3)/'DROTG '/
69      DATA             L(4)/' DROT '/
70      DATA             L(5)/'DCOPY '/
71      DATA             L(6)/'DSWAP '/
72      DATA             L(7)/'DNRM2 '/
73      DATA             L(8)/'DASUM '/
74      DATA             L(9)/'DSCAL '/
75      DATA             L(10)/'IDAMAX'/
76*     .. Executable Statements ..
77      WRITE (NOUT,99999) ICASE, L(ICASE)
78      RETURN
79*
8099999 FORMAT (/' Test of subprogram number',I3,12X,A6)
81      END
82      SUBROUTINE CHECK0(SFAC)
83*     .. Parameters ..
84      INTEGER           NOUT
85      PARAMETER         (NOUT=6)
86*     .. Scalar Arguments ..
87      DOUBLE PRECISION  SFAC
88*     .. Scalars in Common ..
89      INTEGER           ICASE, INCX, INCY, MODE, N
90      LOGICAL           PASS
91*     .. Local Scalars ..
92      DOUBLE PRECISION  D12, SA, SB, SC, SS
93      INTEGER           K
94*     .. Local Arrays ..
95      DOUBLE PRECISION  DA1(8), DATRUE(8), DB1(8), DBTRUE(8), DC1(8),
96     +                  DS1(8)
97*     .. External Subroutines ..
98      EXTERNAL          DROTG, STEST1
99*     .. Common blocks ..
100      COMMON            /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
101*     .. Data statements ..
102      DATA              DA1/0.3D0, 0.4D0, -0.3D0, -0.4D0, -0.3D0, 0.0D0,
103     +                  0.0D0, 1.0D0/
104      DATA              DB1/0.4D0, 0.3D0, 0.4D0, 0.3D0, -0.4D0, 0.0D0,
105     +                  1.0D0, 0.0D0/
106      DATA              DC1/0.6D0, 0.8D0, -0.6D0, 0.8D0, 0.6D0, 1.0D0,
107     +                  0.0D0, 1.0D0/
108      DATA              DS1/0.8D0, 0.6D0, 0.8D0, -0.6D0, 0.8D0, 0.0D0,
109     +                  1.0D0, 0.0D0/
110      DATA              DATRUE/0.5D0, 0.5D0, 0.5D0, -0.5D0, -0.5D0,
111     +                  0.0D0, 1.0D0, 1.0D0/
112      DATA              DBTRUE/0.0D0, 0.6D0, 0.0D0, -0.6D0, 0.0D0,
113     +                  0.0D0, 1.0D0, 0.0D0/
114      DATA              D12/4096.0D0/
115*     .. Executable Statements ..
116*
117*     Compute true values which cannot be prestored
118*     in decimal notation
119*
120      DBTRUE(1) = 1.0D0/0.6D0
121      DBTRUE(3) = -1.0D0/0.6D0
122      DBTRUE(5) = 1.0D0/0.6D0
123*
124      DO 20 K = 1, 8
125*        .. Set N=K for identification in output if any ..
126         N = K
127         IF (ICASE.EQ.3) THEN
128*           .. DROTG ..
129            IF (K.GT.8) GO TO 40
130            SA = DA1(K)
131            SB = DB1(K)
132            CALL DROTG(SA,SB,SC,SS)
133            CALL STEST1(SA,DATRUE(K),DATRUE(K),SFAC)
134            CALL STEST1(SB,DBTRUE(K),DBTRUE(K),SFAC)
135            CALL STEST1(SC,DC1(K),DC1(K),SFAC)
136            CALL STEST1(SS,DS1(K),DS1(K),SFAC)
137         ELSE
138            WRITE (NOUT,*) ' Shouldn''t be here in CHECK0'
139            STOP
140         END IF
141   20 CONTINUE
142   40 RETURN
143      END
144      SUBROUTINE CHECK1(SFAC)
145*     .. Parameters ..
146      INTEGER           NOUT
147      PARAMETER         (NOUT=6)
148*     .. Scalar Arguments ..
149      DOUBLE PRECISION  SFAC
150*     .. Scalars in Common ..
151      INTEGER           ICASE, INCX, INCY, MODE, N
152      LOGICAL           PASS
153*     .. Local Scalars ..
154      INTEGER           I, LEN, NP1
155*     .. Local Arrays ..
156      DOUBLE PRECISION  DTRUE1(5), DTRUE3(5), DTRUE5(8,5,2), DV(8,5,2),
157     +                  SA(10), STEMP(1), STRUE(8), SX(8)
158      INTEGER           ITRUE2(5)
159*     .. External Functions ..
160      DOUBLE PRECISION  DASUM, DNRM2
161      INTEGER           IDAMAX
162      EXTERNAL          DASUM, DNRM2, IDAMAX
163*     .. External Subroutines ..
164      EXTERNAL          ITEST1, DSCAL, STEST, STEST1
165*     .. Intrinsic Functions ..
166      INTRINSIC         MAX
167*     .. Common blocks ..
168      COMMON            /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
169*     .. Data statements ..
170      DATA              SA/0.3D0, -1.0D0, 0.0D0, 1.0D0, 0.3D0, 0.3D0,
171     +                  0.3D0, 0.3D0, 0.3D0, 0.3D0/
172      DATA              DV/0.1D0, 2.0D0, 2.0D0, 2.0D0, 2.0D0, 2.0D0,
173     +                  2.0D0, 2.0D0, 0.3D0, 3.0D0, 3.0D0, 3.0D0, 3.0D0,
174     +                  3.0D0, 3.0D0, 3.0D0, 0.3D0, -0.4D0, 4.0D0,
175     +                  4.0D0, 4.0D0, 4.0D0, 4.0D0, 4.0D0, 0.2D0,
176     +                  -0.6D0, 0.3D0, 5.0D0, 5.0D0, 5.0D0, 5.0D0,
177     +                  5.0D0, 0.1D0, -0.3D0, 0.5D0, -0.1D0, 6.0D0,
178     +                  6.0D0, 6.0D0, 6.0D0, 0.1D0, 8.0D0, 8.0D0, 8.0D0,
179     +                  8.0D0, 8.0D0, 8.0D0, 8.0D0, 0.3D0, 9.0D0, 9.0D0,
180     +                  9.0D0, 9.0D0, 9.0D0, 9.0D0, 9.0D0, 0.3D0, 2.0D0,
181     +                  -0.4D0, 2.0D0, 2.0D0, 2.0D0, 2.0D0, 2.0D0,
182     +                  0.2D0, 3.0D0, -0.6D0, 5.0D0, 0.3D0, 2.0D0,
183     +                  2.0D0, 2.0D0, 0.1D0, 4.0D0, -0.3D0, 6.0D0,
184     +                  -0.5D0, 7.0D0, -0.1D0, 3.0D0/
185      DATA              DTRUE1/0.0D0, 0.3D0, 0.5D0, 0.7D0, 0.6D0/
186      DATA              DTRUE3/0.0D0, 0.3D0, 0.7D0, 1.1D0, 1.0D0/
187      DATA              DTRUE5/0.10D0, 2.0D0, 2.0D0, 2.0D0, 2.0D0,
188     +                  2.0D0, 2.0D0, 2.0D0, -0.3D0, 3.0D0, 3.0D0,
189     +                  3.0D0, 3.0D0, 3.0D0, 3.0D0, 3.0D0, 0.0D0, 0.0D0,
190     +                  4.0D0, 4.0D0, 4.0D0, 4.0D0, 4.0D0, 4.0D0,
191     +                  0.20D0, -0.60D0, 0.30D0, 5.0D0, 5.0D0, 5.0D0,
192     +                  5.0D0, 5.0D0, 0.03D0, -0.09D0, 0.15D0, -0.03D0,
193     +                  6.0D0, 6.0D0, 6.0D0, 6.0D0, 0.10D0, 8.0D0,
194     +                  8.0D0, 8.0D0, 8.0D0, 8.0D0, 8.0D0, 8.0D0,
195     +                  0.09D0, 9.0D0, 9.0D0, 9.0D0, 9.0D0, 9.0D0,
196     +                  9.0D0, 9.0D0, 0.09D0, 2.0D0, -0.12D0, 2.0D0,
197     +                  2.0D0, 2.0D0, 2.0D0, 2.0D0, 0.06D0, 3.0D0,
198     +                  -0.18D0, 5.0D0, 0.09D0, 2.0D0, 2.0D0, 2.0D0,
199     +                  0.03D0, 4.0D0, -0.09D0, 6.0D0, -0.15D0, 7.0D0,
200     +                  -0.03D0, 3.0D0/
201      DATA              ITRUE2/0, 1, 2, 2, 3/
202*     .. Executable Statements ..
203      DO 80 INCX = 1, 2
204         DO 60 NP1 = 1, 5
205            N = NP1 - 1
206            LEN = 2*MAX(N,1)
207*           .. Set vector arguments ..
208            DO 20 I = 1, LEN
209               SX(I) = DV(I,NP1,INCX)
210   20       CONTINUE
211*
212            IF (ICASE.EQ.7) THEN
213*              .. DNRM2 ..
214               STEMP(1) = DTRUE1(NP1)
215               CALL STEST1(DNRM2(N,SX,INCX),STEMP,STEMP,SFAC)
216            ELSE IF (ICASE.EQ.8) THEN
217*              .. DASUM ..
218               STEMP(1) = DTRUE3(NP1)
219               CALL STEST1(DASUM(N,SX,INCX),STEMP,STEMP,SFAC)
220            ELSE IF (ICASE.EQ.9) THEN
221*              .. DSCAL ..
222               CALL DSCAL(N,SA((INCX-1)*5+NP1),SX,INCX)
223               DO 40 I = 1, LEN
224                  STRUE(I) = DTRUE5(I,NP1,INCX)
225   40          CONTINUE
226               CALL STEST(LEN,SX,STRUE,STRUE,SFAC)
227            ELSE IF (ICASE.EQ.10) THEN
228*              .. IDAMAX ..
229               CALL ITEST1(IDAMAX(N,SX,INCX),ITRUE2(NP1))
230            ELSE
231               WRITE (NOUT,*) ' Shouldn''t be here in CHECK1'
232               STOP
233            END IF
234   60    CONTINUE
235   80 CONTINUE
236      RETURN
237      END
238      SUBROUTINE CHECK2(SFAC)
239*     .. Parameters ..
240      INTEGER           NOUT
241      PARAMETER         (NOUT=6)
242*     .. Scalar Arguments ..
243      DOUBLE PRECISION  SFAC
244*     .. Scalars in Common ..
245      INTEGER           ICASE, INCX, INCY, MODE, N
246      LOGICAL           PASS
247*     .. Local Scalars ..
248      DOUBLE PRECISION  SA, SC, SS
249      INTEGER           I, J, KI, KN, KSIZE, LENX, LENY, MX, MY
250*     .. Local Arrays ..
251      DOUBLE PRECISION  DT10X(7,4,4), DT10Y(7,4,4), DT7(4,4),
252     +                  DT8(7,4,4), DT9X(7,4,4), DT9Y(7,4,4), DX1(7),
253     +                  DY1(7), SSIZE1(4), SSIZE2(14,2), STX(7), STY(7),
254     +                  SX(7), SY(7)
255      INTEGER           INCXS(4), INCYS(4), LENS(4,2), NS(4)
256*     .. External Functions ..
257      DOUBLE PRECISION  DDOT
258      EXTERNAL          DDOT
259*     .. External Subroutines ..
260      EXTERNAL          DAXPY, DCOPY, DSWAP, STEST, STEST1
261*     .. Intrinsic Functions ..
262      INTRINSIC         ABS, MIN
263*     .. Common blocks ..
264      COMMON            /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
265*     .. Data statements ..
266      DATA              SA/0.3D0/
267      DATA              INCXS/1, 2, -2, -1/
268      DATA              INCYS/1, -2, 1, -2/
269      DATA              LENS/1, 1, 2, 4, 1, 1, 3, 7/
270      DATA              NS/0, 1, 2, 4/
271      DATA              DX1/0.6D0, 0.1D0, -0.5D0, 0.8D0, 0.9D0, -0.3D0,
272     +                  -0.4D0/
273      DATA              DY1/0.5D0, -0.9D0, 0.3D0, 0.7D0, -0.6D0, 0.2D0,
274     +                  0.8D0/
275      DATA              SC, SS/0.8D0, 0.6D0/
276      DATA              DT7/0.0D0, 0.30D0, 0.21D0, 0.62D0, 0.0D0,
277     +                  0.30D0, -0.07D0, 0.85D0, 0.0D0, 0.30D0, -0.79D0,
278     +                  -0.74D0, 0.0D0, 0.30D0, 0.33D0, 1.27D0/
279      DATA              DT8/0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
280     +                  0.0D0, 0.68D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
281     +                  0.0D0, 0.0D0, 0.68D0, -0.87D0, 0.0D0, 0.0D0,
282     +                  0.0D0, 0.0D0, 0.0D0, 0.68D0, -0.87D0, 0.15D0,
283     +                  0.94D0, 0.0D0, 0.0D0, 0.0D0, 0.5D0, 0.0D0,
284     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.68D0,
285     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
286     +                  0.35D0, -0.9D0, 0.48D0, 0.0D0, 0.0D0, 0.0D0,
287     +                  0.0D0, 0.38D0, -0.9D0, 0.57D0, 0.7D0, -0.75D0,
288     +                  0.2D0, 0.98D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0,
289     +                  0.0D0, 0.0D0, 0.0D0, 0.68D0, 0.0D0, 0.0D0,
290     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.35D0, -0.72D0,
291     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.38D0,
292     +                  -0.63D0, 0.15D0, 0.88D0, 0.0D0, 0.0D0, 0.0D0,
293     +                  0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
294     +                  0.68D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
295     +                  0.0D0, 0.68D0, -0.9D0, 0.33D0, 0.0D0, 0.0D0,
296     +                  0.0D0, 0.0D0, 0.68D0, -0.9D0, 0.33D0, 0.7D0,
297     +                  -0.75D0, 0.2D0, 1.04D0/
298      DATA              DT9X/0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
299     +                  0.0D0, 0.78D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
300     +                  0.0D0, 0.0D0, 0.78D0, -0.46D0, 0.0D0, 0.0D0,
301     +                  0.0D0, 0.0D0, 0.0D0, 0.78D0, -0.46D0, -0.22D0,
302     +                  1.06D0, 0.0D0, 0.0D0, 0.0D0, 0.6D0, 0.0D0,
303     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.78D0,
304     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
305     +                  0.66D0, 0.1D0, -0.1D0, 0.0D0, 0.0D0, 0.0D0,
306     +                  0.0D0, 0.96D0, 0.1D0, -0.76D0, 0.8D0, 0.90D0,
307     +                  -0.3D0, -0.02D0, 0.6D0, 0.0D0, 0.0D0, 0.0D0,
308     +                  0.0D0, 0.0D0, 0.0D0, 0.78D0, 0.0D0, 0.0D0,
309     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, -0.06D0, 0.1D0,
310     +                  -0.1D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.90D0,
311     +                  0.1D0, -0.22D0, 0.8D0, 0.18D0, -0.3D0, -0.02D0,
312     +                  0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
313     +                  0.78D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
314     +                  0.0D0, 0.78D0, 0.26D0, 0.0D0, 0.0D0, 0.0D0,
315     +                  0.0D0, 0.0D0, 0.78D0, 0.26D0, -0.76D0, 1.12D0,
316     +                  0.0D0, 0.0D0, 0.0D0/
317      DATA              DT9Y/0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
318     +                  0.0D0, 0.04D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
319     +                  0.0D0, 0.0D0, 0.04D0, -0.78D0, 0.0D0, 0.0D0,
320     +                  0.0D0, 0.0D0, 0.0D0, 0.04D0, -0.78D0, 0.54D0,
321     +                  0.08D0, 0.0D0, 0.0D0, 0.0D0, 0.5D0, 0.0D0,
322     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.04D0,
323     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.7D0,
324     +                  -0.9D0, -0.12D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
325     +                  0.64D0, -0.9D0, -0.30D0, 0.7D0, -0.18D0, 0.2D0,
326     +                  0.28D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
327     +                  0.0D0, 0.0D0, 0.04D0, 0.0D0, 0.0D0, 0.0D0,
328     +                  0.0D0, 0.0D0, 0.0D0, 0.7D0, -1.08D0, 0.0D0,
329     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.64D0, -1.26D0,
330     +                  0.54D0, 0.20D0, 0.0D0, 0.0D0, 0.0D0, 0.5D0,
331     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
332     +                  0.04D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
333     +                  0.0D0, 0.04D0, -0.9D0, 0.18D0, 0.0D0, 0.0D0,
334     +                  0.0D0, 0.0D0, 0.04D0, -0.9D0, 0.18D0, 0.7D0,
335     +                  -0.18D0, 0.2D0, 0.16D0/
336      DATA              DT10X/0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
337     +                  0.0D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
338     +                  0.0D0, 0.5D0, -0.9D0, 0.0D0, 0.0D0, 0.0D0,
339     +                  0.0D0, 0.0D0, 0.5D0, -0.9D0, 0.3D0, 0.7D0,
340     +                  0.0D0, 0.0D0, 0.0D0, 0.6D0, 0.0D0, 0.0D0, 0.0D0,
341     +                  0.0D0, 0.0D0, 0.0D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0,
342     +                  0.0D0, 0.0D0, 0.0D0, 0.3D0, 0.1D0, 0.5D0, 0.0D0,
343     +                  0.0D0, 0.0D0, 0.0D0, 0.8D0, 0.1D0, -0.6D0,
344     +                  0.8D0, 0.3D0, -0.3D0, 0.5D0, 0.6D0, 0.0D0,
345     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.5D0, 0.0D0,
346     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, -0.9D0,
347     +                  0.1D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.7D0,
348     +                  0.1D0, 0.3D0, 0.8D0, -0.9D0, -0.3D0, 0.5D0,
349     +                  0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
350     +                  0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
351     +                  0.5D0, 0.3D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
352     +                  0.5D0, 0.3D0, -0.6D0, 0.8D0, 0.0D0, 0.0D0,
353     +                  0.0D0/
354      DATA              DT10Y/0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
355     +                  0.0D0, 0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
356     +                  0.0D0, 0.6D0, 0.1D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
357     +                  0.0D0, 0.6D0, 0.1D0, -0.5D0, 0.8D0, 0.0D0,
358     +                  0.0D0, 0.0D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
359     +                  0.0D0, 0.0D0, 0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
360     +                  0.0D0, 0.0D0, -0.5D0, -0.9D0, 0.6D0, 0.0D0,
361     +                  0.0D0, 0.0D0, 0.0D0, -0.4D0, -0.9D0, 0.9D0,
362     +                  0.7D0, -0.5D0, 0.2D0, 0.6D0, 0.5D0, 0.0D0,
363     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.6D0, 0.0D0,
364     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, -0.5D0,
365     +                  0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
366     +                  -0.4D0, 0.9D0, -0.5D0, 0.6D0, 0.0D0, 0.0D0,
367     +                  0.0D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
368     +                  0.0D0, 0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
369     +                  0.0D0, 0.6D0, -0.9D0, 0.1D0, 0.0D0, 0.0D0,
370     +                  0.0D0, 0.0D0, 0.6D0, -0.9D0, 0.1D0, 0.7D0,
371     +                  -0.5D0, 0.2D0, 0.8D0/
372      DATA              SSIZE1/0.0D0, 0.3D0, 1.6D0, 3.2D0/
373      DATA              SSIZE2/0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
374     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
375     +                  0.0D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0,
376     +                  1.17D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0,
377     +                  1.17D0, 1.17D0, 1.17D0/
378*     .. Executable Statements ..
379*
380      DO 120 KI = 1, 4
381         INCX = INCXS(KI)
382         INCY = INCYS(KI)
383         MX = ABS(INCX)
384         MY = ABS(INCY)
385*
386         DO 100 KN = 1, 4
387            N = NS(KN)
388            KSIZE = MIN(2,KN)
389            LENX = LENS(KN,MX)
390            LENY = LENS(KN,MY)
391*           .. Initialize all argument arrays ..
392            DO 20 I = 1, 7
393               SX(I) = DX1(I)
394               SY(I) = DY1(I)
395   20       CONTINUE
396*
397            IF (ICASE.EQ.1) THEN
398*              .. DDOT ..
399               CALL STEST1(DDOT(N,SX,INCX,SY,INCY),DT7(KN,KI),SSIZE1(KN)
400     +                     ,SFAC)
401            ELSE IF (ICASE.EQ.2) THEN
402*              .. DAXPY ..
403               CALL DAXPY(N,SA,SX,INCX,SY,INCY)
404               DO 40 J = 1, LENY
405                  STY(J) = DT8(J,KN,KI)
406   40          CONTINUE
407               CALL STEST(LENY,SY,STY,SSIZE2(1,KSIZE),SFAC)
408            ELSE IF (ICASE.EQ.5) THEN
409*              .. DCOPY ..
410               DO 60 I = 1, 7
411                  STY(I) = DT10Y(I,KN,KI)
412   60          CONTINUE
413               CALL DCOPY(N,SX,INCX,SY,INCY)
414               CALL STEST(LENY,SY,STY,SSIZE2(1,1),1.0D0)
415            ELSE IF (ICASE.EQ.6) THEN
416*              .. DSWAP ..
417               CALL DSWAP(N,SX,INCX,SY,INCY)
418               DO 80 I = 1, 7
419                  STX(I) = DT10X(I,KN,KI)
420                  STY(I) = DT10Y(I,KN,KI)
421   80          CONTINUE
422               CALL STEST(LENX,SX,STX,SSIZE2(1,1),1.0D0)
423               CALL STEST(LENY,SY,STY,SSIZE2(1,1),1.0D0)
424            ELSE
425               WRITE (NOUT,*) ' Shouldn''t be here in CHECK2'
426               STOP
427            END IF
428  100    CONTINUE
429  120 CONTINUE
430      RETURN
431      END
432      SUBROUTINE CHECK3(SFAC)
433*     .. Parameters ..
434      INTEGER           NOUT
435      PARAMETER         (NOUT=6)
436*     .. Scalar Arguments ..
437      DOUBLE PRECISION  SFAC
438*     .. Scalars in Common ..
439      INTEGER           ICASE, INCX, INCY, MODE, N
440      LOGICAL           PASS
441*     .. Local Scalars ..
442      DOUBLE PRECISION  SA, SC, SS
443      INTEGER           I, K, KI, KN, KSIZE, LENX, LENY, MX, MY
444*     .. Local Arrays ..
445      DOUBLE PRECISION  COPYX(5), COPYY(5), DT9X(7,4,4), DT9Y(7,4,4),
446     +                  DX1(7), DY1(7), MWPC(11), MWPS(11), MWPSTX(5),
447     +                  MWPSTY(5), MWPTX(11,5), MWPTY(11,5), MWPX(5),
448     +                  MWPY(5), SSIZE2(14,2), STX(7), STY(7), SX(7),
449     +                  SY(7)
450      INTEGER           INCXS(4), INCYS(4), LENS(4,2), MWPINX(11),
451     +                  MWPINY(11), MWPN(11), NS(4)
452*     .. External Subroutines ..
453      EXTERNAL          DROT, STEST
454*     .. Intrinsic Functions ..
455      INTRINSIC         ABS, MIN
456*     .. Common blocks ..
457      COMMON            /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
458*     .. Data statements ..
459      DATA              SA/0.3D0/
460      DATA              INCXS/1, 2, -2, -1/
461      DATA              INCYS/1, -2, 1, -2/
462      DATA              LENS/1, 1, 2, 4, 1, 1, 3, 7/
463      DATA              NS/0, 1, 2, 4/
464      DATA              DX1/0.6D0, 0.1D0, -0.5D0, 0.8D0, 0.9D0, -0.3D0,
465     +                  -0.4D0/
466      DATA              DY1/0.5D0, -0.9D0, 0.3D0, 0.7D0, -0.6D0, 0.2D0,
467     +                  0.8D0/
468      DATA              SC, SS/0.8D0, 0.6D0/
469      DATA              DT9X/0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
470     +                  0.0D0, 0.78D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
471     +                  0.0D0, 0.0D0, 0.78D0, -0.46D0, 0.0D0, 0.0D0,
472     +                  0.0D0, 0.0D0, 0.0D0, 0.78D0, -0.46D0, -0.22D0,
473     +                  1.06D0, 0.0D0, 0.0D0, 0.0D0, 0.6D0, 0.0D0,
474     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.78D0,
475     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
476     +                  0.66D0, 0.1D0, -0.1D0, 0.0D0, 0.0D0, 0.0D0,
477     +                  0.0D0, 0.96D0, 0.1D0, -0.76D0, 0.8D0, 0.90D0,
478     +                  -0.3D0, -0.02D0, 0.6D0, 0.0D0, 0.0D0, 0.0D0,
479     +                  0.0D0, 0.0D0, 0.0D0, 0.78D0, 0.0D0, 0.0D0,
480     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, -0.06D0, 0.1D0,
481     +                  -0.1D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.90D0,
482     +                  0.1D0, -0.22D0, 0.8D0, 0.18D0, -0.3D0, -0.02D0,
483     +                  0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
484     +                  0.78D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
485     +                  0.0D0, 0.78D0, 0.26D0, 0.0D0, 0.0D0, 0.0D0,
486     +                  0.0D0, 0.0D0, 0.78D0, 0.26D0, -0.76D0, 1.12D0,
487     +                  0.0D0, 0.0D0, 0.0D0/
488      DATA              DT9Y/0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
489     +                  0.0D0, 0.04D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
490     +                  0.0D0, 0.0D0, 0.04D0, -0.78D0, 0.0D0, 0.0D0,
491     +                  0.0D0, 0.0D0, 0.0D0, 0.04D0, -0.78D0, 0.54D0,
492     +                  0.08D0, 0.0D0, 0.0D0, 0.0D0, 0.5D0, 0.0D0,
493     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.04D0,
494     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.7D0,
495     +                  -0.9D0, -0.12D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
496     +                  0.64D0, -0.9D0, -0.30D0, 0.7D0, -0.18D0, 0.2D0,
497     +                  0.28D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
498     +                  0.0D0, 0.0D0, 0.04D0, 0.0D0, 0.0D0, 0.0D0,
499     +                  0.0D0, 0.0D0, 0.0D0, 0.7D0, -1.08D0, 0.0D0,
500     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.64D0, -1.26D0,
501     +                  0.54D0, 0.20D0, 0.0D0, 0.0D0, 0.0D0, 0.5D0,
502     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
503     +                  0.04D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
504     +                  0.0D0, 0.04D0, -0.9D0, 0.18D0, 0.0D0, 0.0D0,
505     +                  0.0D0, 0.0D0, 0.04D0, -0.9D0, 0.18D0, 0.7D0,
506     +                  -0.18D0, 0.2D0, 0.16D0/
507      DATA              SSIZE2/0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
508     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,
509     +                  0.0D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0,
510     +                  1.17D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0,
511     +                  1.17D0, 1.17D0, 1.17D0/
512*     .. Executable Statements ..
513*
514      DO 60 KI = 1, 4
515         INCX = INCXS(KI)
516         INCY = INCYS(KI)
517         MX = ABS(INCX)
518         MY = ABS(INCY)
519*
520         DO 40 KN = 1, 4
521            N = NS(KN)
522            KSIZE = MIN(2,KN)
523            LENX = LENS(KN,MX)
524            LENY = LENS(KN,MY)
525*
526            IF (ICASE.EQ.4) THEN
527*              .. DROT ..
528               DO 20 I = 1, 7
529                  SX(I) = DX1(I)
530                  SY(I) = DY1(I)
531                  STX(I) = DT9X(I,KN,KI)
532                  STY(I) = DT9Y(I,KN,KI)
533   20          CONTINUE
534               CALL DROT(N,SX,INCX,SY,INCY,SC,SS)
535               CALL STEST(LENX,SX,STX,SSIZE2(1,KSIZE),SFAC)
536               CALL STEST(LENY,SY,STY,SSIZE2(1,KSIZE),SFAC)
537            ELSE
538               WRITE (NOUT,*) ' Shouldn''t be here in CHECK3'
539               STOP
540            END IF
541   40    CONTINUE
542   60 CONTINUE
543*
544      MWPC(1) = 1
545      DO 80 I = 2, 11
546         MWPC(I) = 0
547   80 CONTINUE
548      MWPS(1) = 0
549      DO 100 I = 2, 6
550         MWPS(I) = 1
551  100 CONTINUE
552      DO 120 I = 7, 11
553         MWPS(I) = -1
554  120 CONTINUE
555      MWPINX(1) = 1
556      MWPINX(2) = 1
557      MWPINX(3) = 1
558      MWPINX(4) = -1
559      MWPINX(5) = 1
560      MWPINX(6) = -1
561      MWPINX(7) = 1
562      MWPINX(8) = 1
563      MWPINX(9) = -1
564      MWPINX(10) = 1
565      MWPINX(11) = -1
566      MWPINY(1) = 1
567      MWPINY(2) = 1
568      MWPINY(3) = -1
569      MWPINY(4) = -1
570      MWPINY(5) = 2
571      MWPINY(6) = 1
572      MWPINY(7) = 1
573      MWPINY(8) = -1
574      MWPINY(9) = -1
575      MWPINY(10) = 2
576      MWPINY(11) = 1
577      DO 140 I = 1, 11
578         MWPN(I) = 5
579  140 CONTINUE
580      MWPN(5) = 3
581      MWPN(10) = 3
582      DO 160 I = 1, 5
583         MWPX(I) = I
584         MWPY(I) = I
585         MWPTX(1,I) = I
586         MWPTY(1,I) = I
587         MWPTX(2,I) = I
588         MWPTY(2,I) = -I
589         MWPTX(3,I) = 6 - I
590         MWPTY(3,I) = I - 6
591         MWPTX(4,I) = I
592         MWPTY(4,I) = -I
593         MWPTX(6,I) = 6 - I
594         MWPTY(6,I) = I - 6
595         MWPTX(7,I) = -I
596         MWPTY(7,I) = I
597         MWPTX(8,I) = I - 6
598         MWPTY(8,I) = 6 - I
599         MWPTX(9,I) = -I
600         MWPTY(9,I) = I
601         MWPTX(11,I) = I - 6
602         MWPTY(11,I) = 6 - I
603  160 CONTINUE
604      MWPTX(5,1) = 1
605      MWPTX(5,2) = 3
606      MWPTX(5,3) = 5
607      MWPTX(5,4) = 4
608      MWPTX(5,5) = 5
609      MWPTY(5,1) = -1
610      MWPTY(5,2) = 2
611      MWPTY(5,3) = -2
612      MWPTY(5,4) = 4
613      MWPTY(5,5) = -3
614      MWPTX(10,1) = -1
615      MWPTX(10,2) = -3
616      MWPTX(10,3) = -5
617      MWPTX(10,4) = 4
618      MWPTX(10,5) = 5
619      MWPTY(10,1) = 1
620      MWPTY(10,2) = 2
621      MWPTY(10,3) = 2
622      MWPTY(10,4) = 4
623      MWPTY(10,5) = 3
624      DO 200 I = 1, 11
625         INCX = MWPINX(I)
626         INCY = MWPINY(I)
627         DO 180 K = 1, 5
628            COPYX(K) = MWPX(K)
629            COPYY(K) = MWPY(K)
630            MWPSTX(K) = MWPTX(I,K)
631            MWPSTY(K) = MWPTY(I,K)
632  180    CONTINUE
633         CALL DROT(MWPN(I),COPYX,INCX,COPYY,INCY,MWPC(I),MWPS(I))
634         CALL STEST(5,COPYX,MWPSTX,MWPSTX,SFAC)
635         CALL STEST(5,COPYY,MWPSTY,MWPSTY,SFAC)
636  200 CONTINUE
637      RETURN
638      END
639      SUBROUTINE STEST(LEN,SCOMP,STRUE,SSIZE,SFAC)
640*     ********************************* STEST **************************
641*
642*     THIS SUBR COMPARES ARRAYS  SCOMP() AND STRUE() OF LENGTH LEN TO
643*     SEE IF THE TERM BY TERM DIFFERENCES, MULTIPLIED BY SFAC, ARE
644*     NEGLIGIBLE.
645*
646*     C. L. LAWSON, JPL, 1974 DEC 10
647*
648*     .. Parameters ..
649      INTEGER          NOUT
650      PARAMETER        (NOUT=6)
651*     .. Scalar Arguments ..
652      DOUBLE PRECISION SFAC
653      INTEGER          LEN
654*     .. Array Arguments ..
655      DOUBLE PRECISION SCOMP(LEN), SSIZE(LEN), STRUE(LEN)
656*     .. Scalars in Common ..
657      INTEGER          ICASE, INCX, INCY, MODE, N
658      LOGICAL          PASS
659*     .. Local Scalars ..
660      DOUBLE PRECISION SD
661      INTEGER          I
662*     .. External Functions ..
663      DOUBLE PRECISION SDIFF
664      EXTERNAL         SDIFF
665*     .. Intrinsic Functions ..
666      INTRINSIC        ABS
667*     .. Common blocks ..
668      COMMON           /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
669*     .. Executable Statements ..
670*
671      DO 40 I = 1, LEN
672         SD = SCOMP(I) - STRUE(I)
673         IF (SDIFF(ABS(SSIZE(I))+ABS(SFAC*SD),ABS(SSIZE(I))).EQ.0.0D0)
674     +       GO TO 40
675*
676*                             HERE    SCOMP(I) IS NOT CLOSE TO STRUE(I).
677*
678         IF ( .NOT. PASS) GO TO 20
679*                             PRINT FAIL MESSAGE AND HEADER.
680         PASS = .FALSE.
681         WRITE (NOUT,99999)
682         WRITE (NOUT,99998)
683   20    WRITE (NOUT,99997) ICASE, N, INCX, INCY, MODE, I, SCOMP(I),
684     +     STRUE(I), SD, SSIZE(I)
685   40 CONTINUE
686      RETURN
687*
68899999 FORMAT ('                                       FAIL')
68999998 FORMAT (/' CASE  N INCX INCY MODE  I                            ',
690     +       ' COMP(I)                             TRUE(I)  DIFFERENCE',
691     +       '     SIZE(I)',/1X)
69299997 FORMAT (1X,I4,I3,3I5,I3,2D36.8,2D12.4)
693      END
694      SUBROUTINE STEST1(SCOMP1,STRUE1,SSIZE,SFAC)
695*     ************************* STEST1 *****************************
696*
697*     THIS IS AN INTERFACE SUBROUTINE TO ACCOMODATE THE FORTRAN
698*     REQUIREMENT THAT WHEN A DUMMY ARGUMENT IS AN ARRAY, THE
699*     ACTUAL ARGUMENT MUST ALSO BE AN ARRAY OR AN ARRAY ELEMENT.
700*
701*     C.L. LAWSON, JPL, 1978 DEC 6
702*
703*     .. Scalar Arguments ..
704      DOUBLE PRECISION  SCOMP1, SFAC, STRUE1
705*     .. Array Arguments ..
706      DOUBLE PRECISION  SSIZE(*)
707*     .. Local Arrays ..
708      DOUBLE PRECISION  SCOMP(1), STRUE(1)
709*     .. External Subroutines ..
710      EXTERNAL          STEST
711*     .. Executable Statements ..
712*
713      SCOMP(1) = SCOMP1
714      STRUE(1) = STRUE1
715      CALL STEST(1,SCOMP,STRUE,SSIZE,SFAC)
716*
717      RETURN
718      END
719      DOUBLE PRECISION FUNCTION SDIFF(SA,SB)
720*     ********************************* SDIFF **************************
721*     COMPUTES DIFFERENCE OF TWO NUMBERS.  C. L. LAWSON, JPL 1974 FEB 15
722*
723*     .. Scalar Arguments ..
724      DOUBLE PRECISION                SA, SB
725*     .. Executable Statements ..
726      SDIFF = SA - SB
727      RETURN
728      END
729      SUBROUTINE ITEST1(ICOMP,ITRUE)
730*     ********************************* ITEST1 *************************
731*
732*     THIS SUBROUTINE COMPARES THE VARIABLES ICOMP AND ITRUE FOR
733*     EQUALITY.
734*     C. L. LAWSON, JPL, 1974 DEC 10
735*
736*     .. Parameters ..
737      INTEGER           NOUT
738      PARAMETER         (NOUT=6)
739*     .. Scalar Arguments ..
740      INTEGER           ICOMP, ITRUE
741*     .. Scalars in Common ..
742      INTEGER           ICASE, INCX, INCY, MODE, N
743      LOGICAL           PASS
744*     .. Local Scalars ..
745      INTEGER           ID
746*     .. Common blocks ..
747      COMMON            /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
748*     .. Executable Statements ..
749*
750      IF (ICOMP.EQ.ITRUE) GO TO 40
751*
752*                            HERE ICOMP IS NOT EQUAL TO ITRUE.
753*
754      IF ( .NOT. PASS) GO TO 20
755*                             PRINT FAIL MESSAGE AND HEADER.
756      PASS = .FALSE.
757      WRITE (NOUT,99999)
758      WRITE (NOUT,99998)
759   20 ID = ICOMP - ITRUE
760      WRITE (NOUT,99997) ICASE, N, INCX, INCY, MODE, ICOMP, ITRUE, ID
761   40 CONTINUE
762      RETURN
763*
76499999 FORMAT ('                                       FAIL')
76599998 FORMAT (/' CASE  N INCX INCY MODE                               ',
766     +       ' COMP                                TRUE     DIFFERENCE',
767     +       /1X)
76899997 FORMAT (1X,I4,I3,3I5,2I36,I12)
769      END
770