You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

681 lines
30 KiB

  1. PROGRAM CBLAT1
  2. * Test program for the COMPLEX Level 1 BLAS.
  3. * Based upon the original BLAS test routine together with:
  4. * F06GAF 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. REAL SFAC
  13. INTEGER IC
  14. * .. External Subroutines ..
  15. EXTERNAL CHECK1, CHECK2, HEADER
  16. * .. Common blocks ..
  17. COMMON /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
  18. * .. Data statements ..
  19. DATA SFAC/9.765625E-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.LE.5) THEN
  36. CALL CHECK2(SFAC)
  37. ELSE IF (ICASE.GE.6) THEN
  38. CALL CHECK1(SFAC)
  39. END IF
  40. * -- Print
  41. IF (PASS) WRITE (NOUT,99998)
  42. 20 CONTINUE
  43. STOP
  44. *
  45. 99999 FORMAT (' Complex BLAS Test Program Results',/1X)
  46. 99998 FORMAT (' ----- PASS -----')
  47. END
  48. SUBROUTINE HEADER
  49. * .. Parameters ..
  50. INTEGER NOUT
  51. PARAMETER (NOUT=6)
  52. * .. Scalars in Common ..
  53. INTEGER ICASE, INCX, INCY, MODE, N
  54. LOGICAL PASS
  55. * .. Local Arrays ..
  56. CHARACTER*6 L(10)
  57. * .. Common blocks ..
  58. COMMON /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
  59. * .. Data statements ..
  60. DATA L(1)/'CDOTC '/
  61. DATA L(2)/'CDOTU '/
  62. DATA L(3)/'CAXPY '/
  63. DATA L(4)/'CCOPY '/
  64. DATA L(5)/'CSWAP '/
  65. DATA L(6)/'SCNRM2'/
  66. DATA L(7)/'SCASUM'/
  67. DATA L(8)/'CSCAL '/
  68. DATA L(9)/'CSSCAL'/
  69. DATA L(10)/'ICAMAX'/
  70. * .. Executable Statements ..
  71. WRITE (NOUT,99999) ICASE, L(ICASE)
  72. RETURN
  73. *
  74. 99999 FORMAT (/' Test of subprogram number',I3,12X,A6)
  75. END
  76. SUBROUTINE CHECK1(SFAC)
  77. * .. Parameters ..
  78. INTEGER NOUT
  79. PARAMETER (NOUT=6)
  80. * .. Scalar Arguments ..
  81. REAL SFAC
  82. * .. Scalars in Common ..
  83. INTEGER ICASE, INCX, INCY, MODE, N
  84. LOGICAL PASS
  85. * .. Local Scalars ..
  86. COMPLEX CA
  87. REAL SA
  88. INTEGER I, J, LEN, NP1
  89. * .. Local Arrays ..
  90. COMPLEX CTRUE5(8,5,2), CTRUE6(8,5,2), CV(8,5,2), CX(8),
  91. + MWPCS(5), MWPCT(5)
  92. REAL STRUE2(5), STRUE4(5)
  93. INTEGER ITRUE3(5)
  94. * .. External Functions ..
  95. REAL SCASUM, SCNRM2
  96. INTEGER ICAMAX
  97. EXTERNAL SCASUM, SCNRM2, ICAMAX
  98. * .. External Subroutines ..
  99. EXTERNAL CSCAL, CSSCAL, CTEST, ITEST1, STEST1
  100. * .. Intrinsic Functions ..
  101. INTRINSIC MAX
  102. * .. Common blocks ..
  103. COMMON /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
  104. * .. Data statements ..
  105. DATA SA, CA/0.3E0, (0.4E0,-0.7E0)/
  106. DATA ((CV(I,J,1),I=1,8),J=1,5)/(0.1E0,0.1E0),
  107. + (1.0E0,2.0E0), (1.0E0,2.0E0), (1.0E0,2.0E0),
  108. + (1.0E0,2.0E0), (1.0E0,2.0E0), (1.0E0,2.0E0),
  109. + (1.0E0,2.0E0), (0.3E0,-0.4E0), (3.0E0,4.0E0),
  110. + (3.0E0,4.0E0), (3.0E0,4.0E0), (3.0E0,4.0E0),
  111. + (3.0E0,4.0E0), (3.0E0,4.0E0), (3.0E0,4.0E0),
  112. + (0.1E0,-0.3E0), (0.5E0,-0.1E0), (5.0E0,6.0E0),
  113. + (5.0E0,6.0E0), (5.0E0,6.0E0), (5.0E0,6.0E0),
  114. + (5.0E0,6.0E0), (5.0E0,6.0E0), (0.1E0,0.1E0),
  115. + (-0.6E0,0.1E0), (0.1E0,-0.3E0), (7.0E0,8.0E0),
  116. + (7.0E0,8.0E0), (7.0E0,8.0E0), (7.0E0,8.0E0),
  117. + (7.0E0,8.0E0), (0.3E0,0.1E0), (0.1E0,0.4E0),
  118. + (0.4E0,0.1E0), (0.1E0,0.2E0), (2.0E0,3.0E0),
  119. + (2.0E0,3.0E0), (2.0E0,3.0E0), (2.0E0,3.0E0)/
  120. DATA ((CV(I,J,2),I=1,8),J=1,5)/(0.1E0,0.1E0),
  121. + (4.0E0,5.0E0), (4.0E0,5.0E0), (4.0E0,5.0E0),
  122. + (4.0E0,5.0E0), (4.0E0,5.0E0), (4.0E0,5.0E0),
  123. + (4.0E0,5.0E0), (0.3E0,-0.4E0), (6.0E0,7.0E0),
  124. + (6.0E0,7.0E0), (6.0E0,7.0E0), (6.0E0,7.0E0),
  125. + (6.0E0,7.0E0), (6.0E0,7.0E0), (6.0E0,7.0E0),
  126. + (0.1E0,-0.3E0), (8.0E0,9.0E0), (0.5E0,-0.1E0),
  127. + (2.0E0,5.0E0), (2.0E0,5.0E0), (2.0E0,5.0E0),
  128. + (2.0E0,5.0E0), (2.0E0,5.0E0), (0.1E0,0.1E0),
  129. + (3.0E0,6.0E0), (-0.6E0,0.1E0), (4.0E0,7.0E0),
  130. + (0.1E0,-0.3E0), (7.0E0,2.0E0), (7.0E0,2.0E0),
  131. + (7.0E0,2.0E0), (0.3E0,0.1E0), (5.0E0,8.0E0),
  132. + (0.1E0,0.4E0), (6.0E0,9.0E0), (0.4E0,0.1E0),
  133. + (8.0E0,3.0E0), (0.1E0,0.2E0), (9.0E0,4.0E0)/
  134. DATA STRUE2/0.0E0, 0.5E0, 0.6E0, 0.7E0, 0.7E0/
  135. DATA STRUE4/0.0E0, 0.7E0, 1.0E0, 1.3E0, 1.7E0/
  136. DATA ((CTRUE5(I,J,1),I=1,8),J=1,5)/(0.1E0,0.1E0),
  137. + (1.0E0,2.0E0), (1.0E0,2.0E0), (1.0E0,2.0E0),
  138. + (1.0E0,2.0E0), (1.0E0,2.0E0), (1.0E0,2.0E0),
  139. + (1.0E0,2.0E0), (-0.16E0,-0.37E0), (3.0E0,4.0E0),
  140. + (3.0E0,4.0E0), (3.0E0,4.0E0), (3.0E0,4.0E0),
  141. + (3.0E0,4.0E0), (3.0E0,4.0E0), (3.0E0,4.0E0),
  142. + (-0.17E0,-0.19E0), (0.13E0,-0.39E0),
  143. + (5.0E0,6.0E0), (5.0E0,6.0E0), (5.0E0,6.0E0),
  144. + (5.0E0,6.0E0), (5.0E0,6.0E0), (5.0E0,6.0E0),
  145. + (0.11E0,-0.03E0), (-0.17E0,0.46E0),
  146. + (-0.17E0,-0.19E0), (7.0E0,8.0E0), (7.0E0,8.0E0),
  147. + (7.0E0,8.0E0), (7.0E0,8.0E0), (7.0E0,8.0E0),
  148. + (0.19E0,-0.17E0), (0.32E0,0.09E0),
  149. + (0.23E0,-0.24E0), (0.18E0,0.01E0),
  150. + (2.0E0,3.0E0), (2.0E0,3.0E0), (2.0E0,3.0E0),
  151. + (2.0E0,3.0E0)/
  152. DATA ((CTRUE5(I,J,2),I=1,8),J=1,5)/(0.1E0,0.1E0),
  153. + (4.0E0,5.0E0), (4.0E0,5.0E0), (4.0E0,5.0E0),
  154. + (4.0E0,5.0E0), (4.0E0,5.0E0), (4.0E0,5.0E0),
  155. + (4.0E0,5.0E0), (-0.16E0,-0.37E0), (6.0E0,7.0E0),
  156. + (6.0E0,7.0E0), (6.0E0,7.0E0), (6.0E0,7.0E0),
  157. + (6.0E0,7.0E0), (6.0E0,7.0E0), (6.0E0,7.0E0),
  158. + (-0.17E0,-0.19E0), (8.0E0,9.0E0),
  159. + (0.13E0,-0.39E0), (2.0E0,5.0E0), (2.0E0,5.0E0),
  160. + (2.0E0,5.0E0), (2.0E0,5.0E0), (2.0E0,5.0E0),
  161. + (0.11E0,-0.03E0), (3.0E0,6.0E0),
  162. + (-0.17E0,0.46E0), (4.0E0,7.0E0),
  163. + (-0.17E0,-0.19E0), (7.0E0,2.0E0), (7.0E0,2.0E0),
  164. + (7.0E0,2.0E0), (0.19E0,-0.17E0), (5.0E0,8.0E0),
  165. + (0.32E0,0.09E0), (6.0E0,9.0E0),
  166. + (0.23E0,-0.24E0), (8.0E0,3.0E0),
  167. + (0.18E0,0.01E0), (9.0E0,4.0E0)/
  168. DATA ((CTRUE6(I,J,1),I=1,8),J=1,5)/(0.1E0,0.1E0),
  169. + (1.0E0,2.0E0), (1.0E0,2.0E0), (1.0E0,2.0E0),
  170. + (1.0E0,2.0E0), (1.0E0,2.0E0), (1.0E0,2.0E0),
  171. + (1.0E0,2.0E0), (0.09E0,-0.12E0), (3.0E0,4.0E0),
  172. + (3.0E0,4.0E0), (3.0E0,4.0E0), (3.0E0,4.0E0),
  173. + (3.0E0,4.0E0), (3.0E0,4.0E0), (3.0E0,4.0E0),
  174. + (0.03E0,-0.09E0), (0.15E0,-0.03E0),
  175. + (5.0E0,6.0E0), (5.0E0,6.0E0), (5.0E0,6.0E0),
  176. + (5.0E0,6.0E0), (5.0E0,6.0E0), (5.0E0,6.0E0),
  177. + (0.03E0,0.03E0), (-0.18E0,0.03E0),
  178. + (0.03E0,-0.09E0), (7.0E0,8.0E0), (7.0E0,8.0E0),
  179. + (7.0E0,8.0E0), (7.0E0,8.0E0), (7.0E0,8.0E0),
  180. + (0.09E0,0.03E0), (0.03E0,0.12E0),
  181. + (0.12E0,0.03E0), (0.03E0,0.06E0), (2.0E0,3.0E0),
  182. + (2.0E0,3.0E0), (2.0E0,3.0E0), (2.0E0,3.0E0)/
  183. DATA ((CTRUE6(I,J,2),I=1,8),J=1,5)/(0.1E0,0.1E0),
  184. + (4.0E0,5.0E0), (4.0E0,5.0E0), (4.0E0,5.0E0),
  185. + (4.0E0,5.0E0), (4.0E0,5.0E0), (4.0E0,5.0E0),
  186. + (4.0E0,5.0E0), (0.09E0,-0.12E0), (6.0E0,7.0E0),
  187. + (6.0E0,7.0E0), (6.0E0,7.0E0), (6.0E0,7.0E0),
  188. + (6.0E0,7.0E0), (6.0E0,7.0E0), (6.0E0,7.0E0),
  189. + (0.03E0,-0.09E0), (8.0E0,9.0E0),
  190. + (0.15E0,-0.03E0), (2.0E0,5.0E0), (2.0E0,5.0E0),
  191. + (2.0E0,5.0E0), (2.0E0,5.0E0), (2.0E0,5.0E0),
  192. + (0.03E0,0.03E0), (3.0E0,6.0E0),
  193. + (-0.18E0,0.03E0), (4.0E0,7.0E0),
  194. + (0.03E0,-0.09E0), (7.0E0,2.0E0), (7.0E0,2.0E0),
  195. + (7.0E0,2.0E0), (0.09E0,0.03E0), (5.0E0,8.0E0),
  196. + (0.03E0,0.12E0), (6.0E0,9.0E0), (0.12E0,0.03E0),
  197. + (8.0E0,3.0E0), (0.03E0,0.06E0), (9.0E0,4.0E0)/
  198. DATA ITRUE3/0, 1, 2, 2, 2/
  199. * .. Executable Statements ..
  200. DO 60 INCX = 1, 2
  201. DO 40 NP1 = 1, 5
  202. N = NP1 - 1
  203. LEN = 2*MAX(N,1)
  204. * .. Set vector arguments ..
  205. DO 20 I = 1, LEN
  206. CX(I) = CV(I,NP1,INCX)
  207. 20 CONTINUE
  208. IF (ICASE.EQ.6) THEN
  209. * .. SCNRM2 ..
  210. CALL STEST1(SCNRM2(N,CX,INCX),STRUE2(NP1),STRUE2(NP1),
  211. + SFAC)
  212. ELSE IF (ICASE.EQ.7) THEN
  213. * .. SCASUM ..
  214. CALL STEST1(SCASUM(N,CX,INCX),STRUE4(NP1),STRUE4(NP1),
  215. + SFAC)
  216. ELSE IF (ICASE.EQ.8) THEN
  217. * .. CSCAL ..
  218. CALL CSCAL(N,CA,CX,INCX)
  219. CALL CTEST(LEN,CX,CTRUE5(1,NP1,INCX),CTRUE5(1,NP1,INCX),
  220. + SFAC)
  221. ELSE IF (ICASE.EQ.9) THEN
  222. * .. CSSCAL ..
  223. CALL CSSCAL(N,SA,CX,INCX)
  224. CALL CTEST(LEN,CX,CTRUE6(1,NP1,INCX),CTRUE6(1,NP1,INCX),
  225. + SFAC)
  226. ELSE IF (ICASE.EQ.10) THEN
  227. * .. ICAMAX ..
  228. CALL ITEST1(ICAMAX(N,CX,INCX),ITRUE3(NP1))
  229. ELSE
  230. WRITE (NOUT,*) ' Shouldn''t be here in CHECK1'
  231. STOP
  232. END IF
  233. *
  234. 40 CONTINUE
  235. 60 CONTINUE
  236. *
  237. INCX = 1
  238. IF (ICASE.EQ.8) THEN
  239. * CSCAL
  240. * Add a test for alpha equal to zero.
  241. CA = (0.0E0,0.0E0)
  242. DO 80 I = 1, 5
  243. MWPCT(I) = (0.0E0,0.0E0)
  244. MWPCS(I) = (1.0E0,1.0E0)
  245. 80 CONTINUE
  246. CALL CSCAL(5,CA,CX,INCX)
  247. CALL CTEST(5,CX,MWPCT,MWPCS,SFAC)
  248. ELSE IF (ICASE.EQ.9) THEN
  249. * CSSCAL
  250. * Add a test for alpha equal to zero.
  251. SA = 0.0E0
  252. DO 100 I = 1, 5
  253. MWPCT(I) = (0.0E0,0.0E0)
  254. MWPCS(I) = (1.0E0,1.0E0)
  255. 100 CONTINUE
  256. CALL CSSCAL(5,SA,CX,INCX)
  257. CALL CTEST(5,CX,MWPCT,MWPCS,SFAC)
  258. * Add a test for alpha equal to one.
  259. SA = 1.0E0
  260. DO 120 I = 1, 5
  261. MWPCT(I) = CX(I)
  262. MWPCS(I) = CX(I)
  263. 120 CONTINUE
  264. CALL CSSCAL(5,SA,CX,INCX)
  265. CALL CTEST(5,CX,MWPCT,MWPCS,SFAC)
  266. * Add a test for alpha equal to minus one.
  267. SA = -1.0E0
  268. DO 140 I = 1, 5
  269. MWPCT(I) = -CX(I)
  270. MWPCS(I) = -CX(I)
  271. 140 CONTINUE
  272. CALL CSSCAL(5,SA,CX,INCX)
  273. CALL CTEST(5,CX,MWPCT,MWPCS,SFAC)
  274. END IF
  275. RETURN
  276. END
  277. SUBROUTINE CHECK2(SFAC)
  278. * .. Parameters ..
  279. INTEGER NOUT
  280. PARAMETER (NOUT=6)
  281. * .. Scalar Arguments ..
  282. REAL SFAC
  283. * .. Scalars in Common ..
  284. INTEGER ICASE, INCX, INCY, MODE, N
  285. LOGICAL PASS
  286. * .. Local Scalars ..
  287. COMPLEX CA
  288. INTEGER I, J, KI, KN, KSIZE, LENX, LENY, MX, MY
  289. * .. Local Arrays ..
  290. COMPLEX CDOT(1), CSIZE1(4), CSIZE2(7,2), CSIZE3(14),
  291. + CT10X(7,4,4), CT10Y(7,4,4), CT6(4,4), CT7(4,4),
  292. + CT8(7,4,4), CX(7), CX1(7), CY(7), CY1(7)
  293. INTEGER INCXS(4), INCYS(4), LENS(4,2), NS(4)
  294. * .. External Functions ..
  295. COMPLEX CDOTC, CDOTU
  296. EXTERNAL CDOTC, CDOTU
  297. * .. External Subroutines ..
  298. EXTERNAL CAXPY, CCOPY, CSWAP, CTEST
  299. * .. Intrinsic Functions ..
  300. INTRINSIC ABS, MIN
  301. * .. Common blocks ..
  302. COMMON /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
  303. * .. Data statements ..
  304. DATA CA/(0.4E0,-0.7E0)/
  305. DATA INCXS/1, 2, -2, -1/
  306. DATA INCYS/1, -2, 1, -2/
  307. DATA LENS/1, 1, 2, 4, 1, 1, 3, 7/
  308. DATA NS/0, 1, 2, 4/
  309. DATA CX1/(0.7E0,-0.8E0), (-0.4E0,-0.7E0),
  310. + (-0.1E0,-0.9E0), (0.2E0,-0.8E0),
  311. + (-0.9E0,-0.4E0), (0.1E0,0.4E0), (-0.6E0,0.6E0)/
  312. DATA CY1/(0.6E0,-0.6E0), (-0.9E0,0.5E0),
  313. + (0.7E0,-0.6E0), (0.1E0,-0.5E0), (-0.1E0,-0.2E0),
  314. + (-0.5E0,-0.3E0), (0.8E0,-0.7E0)/
  315. DATA ((CT8(I,J,1),I=1,7),J=1,4)/(0.6E0,-0.6E0),
  316. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  317. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  318. + (0.32E0,-1.41E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  319. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  320. + (0.0E0,0.0E0), (0.32E0,-1.41E0),
  321. + (-1.55E0,0.5E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  322. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  323. + (0.32E0,-1.41E0), (-1.55E0,0.5E0),
  324. + (0.03E0,-0.89E0), (-0.38E0,-0.96E0),
  325. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0)/
  326. DATA ((CT8(I,J,2),I=1,7),J=1,4)/(0.6E0,-0.6E0),
  327. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  328. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  329. + (0.32E0,-1.41E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  330. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  331. + (0.0E0,0.0E0), (-0.07E0,-0.89E0),
  332. + (-0.9E0,0.5E0), (0.42E0,-1.41E0), (0.0E0,0.0E0),
  333. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  334. + (0.78E0,0.06E0), (-0.9E0,0.5E0),
  335. + (0.06E0,-0.13E0), (0.1E0,-0.5E0),
  336. + (-0.77E0,-0.49E0), (-0.5E0,-0.3E0),
  337. + (0.52E0,-1.51E0)/
  338. DATA ((CT8(I,J,3),I=1,7),J=1,4)/(0.6E0,-0.6E0),
  339. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  340. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  341. + (0.32E0,-1.41E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  342. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  343. + (0.0E0,0.0E0), (-0.07E0,-0.89E0),
  344. + (-1.18E0,-0.31E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  345. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  346. + (0.78E0,0.06E0), (-1.54E0,0.97E0),
  347. + (0.03E0,-0.89E0), (-0.18E0,-1.31E0),
  348. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0)/
  349. DATA ((CT8(I,J,4),I=1,7),J=1,4)/(0.6E0,-0.6E0),
  350. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  351. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  352. + (0.32E0,-1.41E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  353. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  354. + (0.0E0,0.0E0), (0.32E0,-1.41E0), (-0.9E0,0.5E0),
  355. + (0.05E0,-0.6E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  356. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.32E0,-1.41E0),
  357. + (-0.9E0,0.5E0), (0.05E0,-0.6E0), (0.1E0,-0.5E0),
  358. + (-0.77E0,-0.49E0), (-0.5E0,-0.3E0),
  359. + (0.32E0,-1.16E0)/
  360. DATA CT7/(0.0E0,0.0E0), (-0.06E0,-0.90E0),
  361. + (0.65E0,-0.47E0), (-0.34E0,-1.22E0),
  362. + (0.0E0,0.0E0), (-0.06E0,-0.90E0),
  363. + (-0.59E0,-1.46E0), (-1.04E0,-0.04E0),
  364. + (0.0E0,0.0E0), (-0.06E0,-0.90E0),
  365. + (-0.83E0,0.59E0), (0.07E0,-0.37E0),
  366. + (0.0E0,0.0E0), (-0.06E0,-0.90E0),
  367. + (-0.76E0,-1.15E0), (-1.33E0,-1.82E0)/
  368. DATA CT6/(0.0E0,0.0E0), (0.90E0,0.06E0),
  369. + (0.91E0,-0.77E0), (1.80E0,-0.10E0),
  370. + (0.0E0,0.0E0), (0.90E0,0.06E0), (1.45E0,0.74E0),
  371. + (0.20E0,0.90E0), (0.0E0,0.0E0), (0.90E0,0.06E0),
  372. + (-0.55E0,0.23E0), (0.83E0,-0.39E0),
  373. + (0.0E0,0.0E0), (0.90E0,0.06E0), (1.04E0,0.79E0),
  374. + (1.95E0,1.22E0)/
  375. DATA ((CT10X(I,J,1),I=1,7),J=1,4)/(0.7E0,-0.8E0),
  376. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  377. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  378. + (0.6E0,-0.6E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  379. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  380. + (0.0E0,0.0E0), (0.6E0,-0.6E0), (-0.9E0,0.5E0),
  381. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  382. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.6E0,-0.6E0),
  383. + (-0.9E0,0.5E0), (0.7E0,-0.6E0), (0.1E0,-0.5E0),
  384. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0)/
  385. DATA ((CT10X(I,J,2),I=1,7),J=1,4)/(0.7E0,-0.8E0),
  386. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  387. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  388. + (0.6E0,-0.6E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  389. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  390. + (0.0E0,0.0E0), (0.7E0,-0.6E0), (-0.4E0,-0.7E0),
  391. + (0.6E0,-0.6E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  392. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.8E0,-0.7E0),
  393. + (-0.4E0,-0.7E0), (-0.1E0,-0.2E0),
  394. + (0.2E0,-0.8E0), (0.7E0,-0.6E0), (0.1E0,0.4E0),
  395. + (0.6E0,-0.6E0)/
  396. DATA ((CT10X(I,J,3),I=1,7),J=1,4)/(0.7E0,-0.8E0),
  397. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  398. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  399. + (0.6E0,-0.6E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  400. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  401. + (0.0E0,0.0E0), (-0.9E0,0.5E0), (-0.4E0,-0.7E0),
  402. + (0.6E0,-0.6E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  403. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.1E0,-0.5E0),
  404. + (-0.4E0,-0.7E0), (0.7E0,-0.6E0), (0.2E0,-0.8E0),
  405. + (-0.9E0,0.5E0), (0.1E0,0.4E0), (0.6E0,-0.6E0)/
  406. DATA ((CT10X(I,J,4),I=1,7),J=1,4)/(0.7E0,-0.8E0),
  407. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  408. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  409. + (0.6E0,-0.6E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  410. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  411. + (0.0E0,0.0E0), (0.6E0,-0.6E0), (0.7E0,-0.6E0),
  412. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  413. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.6E0,-0.6E0),
  414. + (0.7E0,-0.6E0), (-0.1E0,-0.2E0), (0.8E0,-0.7E0),
  415. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0)/
  416. DATA ((CT10Y(I,J,1),I=1,7),J=1,4)/(0.6E0,-0.6E0),
  417. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  418. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  419. + (0.7E0,-0.8E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  420. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  421. + (0.0E0,0.0E0), (0.7E0,-0.8E0), (-0.4E0,-0.7E0),
  422. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  423. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.7E0,-0.8E0),
  424. + (-0.4E0,-0.7E0), (-0.1E0,-0.9E0),
  425. + (0.2E0,-0.8E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  426. + (0.0E0,0.0E0)/
  427. DATA ((CT10Y(I,J,2),I=1,7),J=1,4)/(0.6E0,-0.6E0),
  428. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  429. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  430. + (0.7E0,-0.8E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  431. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  432. + (0.0E0,0.0E0), (-0.1E0,-0.9E0), (-0.9E0,0.5E0),
  433. + (0.7E0,-0.8E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  434. + (0.0E0,0.0E0), (0.0E0,0.0E0), (-0.6E0,0.6E0),
  435. + (-0.9E0,0.5E0), (-0.9E0,-0.4E0), (0.1E0,-0.5E0),
  436. + (-0.1E0,-0.9E0), (-0.5E0,-0.3E0),
  437. + (0.7E0,-0.8E0)/
  438. DATA ((CT10Y(I,J,3),I=1,7),J=1,4)/(0.6E0,-0.6E0),
  439. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  440. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  441. + (0.7E0,-0.8E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  442. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  443. + (0.0E0,0.0E0), (-0.1E0,-0.9E0), (0.7E0,-0.8E0),
  444. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  445. + (0.0E0,0.0E0), (0.0E0,0.0E0), (-0.6E0,0.6E0),
  446. + (-0.9E0,-0.4E0), (-0.1E0,-0.9E0),
  447. + (0.7E0,-0.8E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  448. + (0.0E0,0.0E0)/
  449. DATA ((CT10Y(I,J,4),I=1,7),J=1,4)/(0.6E0,-0.6E0),
  450. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  451. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  452. + (0.7E0,-0.8E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  453. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  454. + (0.0E0,0.0E0), (0.7E0,-0.8E0), (-0.9E0,0.5E0),
  455. + (-0.4E0,-0.7E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  456. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.7E0,-0.8E0),
  457. + (-0.9E0,0.5E0), (-0.4E0,-0.7E0), (0.1E0,-0.5E0),
  458. + (-0.1E0,-0.9E0), (-0.5E0,-0.3E0),
  459. + (0.2E0,-0.8E0)/
  460. DATA CSIZE1/(0.0E0,0.0E0), (0.9E0,0.9E0),
  461. + (1.63E0,1.73E0), (2.90E0,2.78E0)/
  462. DATA CSIZE3/(0.0E0,0.0E0), (0.0E0,0.0E0),
  463. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  464. + (0.0E0,0.0E0), (0.0E0,0.0E0), (1.17E0,1.17E0),
  465. + (1.17E0,1.17E0), (1.17E0,1.17E0),
  466. + (1.17E0,1.17E0), (1.17E0,1.17E0),
  467. + (1.17E0,1.17E0), (1.17E0,1.17E0)/
  468. DATA CSIZE2/(0.0E0,0.0E0), (0.0E0,0.0E0),
  469. + (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),
  470. + (0.0E0,0.0E0), (0.0E0,0.0E0), (1.54E0,1.54E0),
  471. + (1.54E0,1.54E0), (1.54E0,1.54E0),
  472. + (1.54E0,1.54E0), (1.54E0,1.54E0),
  473. + (1.54E0,1.54E0), (1.54E0,1.54E0)/
  474. * .. Executable Statements ..
  475. DO 60 KI = 1, 4
  476. INCX = INCXS(KI)
  477. INCY = INCYS(KI)
  478. MX = ABS(INCX)
  479. MY = ABS(INCY)
  480. *
  481. DO 40 KN = 1, 4
  482. N = NS(KN)
  483. KSIZE = MIN(2,KN)
  484. LENX = LENS(KN,MX)
  485. LENY = LENS(KN,MY)
  486. * .. initialize all argument arrays ..
  487. DO 20 I = 1, 7
  488. CX(I) = CX1(I)
  489. CY(I) = CY1(I)
  490. 20 CONTINUE
  491. IF (ICASE.EQ.1) THEN
  492. * .. CDOTC ..
  493. CDOT(1) = CDOTC(N,CX,INCX,CY,INCY)
  494. CALL CTEST(1,CDOT,CT6(KN,KI),CSIZE1(KN),SFAC)
  495. ELSE IF (ICASE.EQ.2) THEN
  496. * .. CDOTU ..
  497. CDOT(1) = CDOTU(N,CX,INCX,CY,INCY)
  498. CALL CTEST(1,CDOT,CT7(KN,KI),CSIZE1(KN),SFAC)
  499. ELSE IF (ICASE.EQ.3) THEN
  500. * .. CAXPY ..
  501. CALL CAXPY(N,CA,CX,INCX,CY,INCY)
  502. CALL CTEST(LENY,CY,CT8(1,KN,KI),CSIZE2(1,KSIZE),SFAC)
  503. ELSE IF (ICASE.EQ.4) THEN
  504. * .. CCOPY ..
  505. CALL CCOPY(N,CX,INCX,CY,INCY)
  506. CALL CTEST(LENY,CY,CT10Y(1,KN,KI),CSIZE3,1.0E0)
  507. ELSE IF (ICASE.EQ.5) THEN
  508. * .. CSWAP ..
  509. CALL CSWAP(N,CX,INCX,CY,INCY)
  510. CALL CTEST(LENX,CX,CT10X(1,KN,KI),CSIZE3,1.0E0)
  511. CALL CTEST(LENY,CY,CT10Y(1,KN,KI),CSIZE3,1.0E0)
  512. ELSE
  513. WRITE (NOUT,*) ' Shouldn''t be here in CHECK2'
  514. STOP
  515. END IF
  516. *
  517. 40 CONTINUE
  518. 60 CONTINUE
  519. RETURN
  520. END
  521. SUBROUTINE STEST(LEN,SCOMP,STRUE,SSIZE,SFAC)
  522. * ********************************* STEST **************************
  523. *
  524. * THIS SUBR COMPARES ARRAYS SCOMP() AND STRUE() OF LENGTH LEN TO
  525. * SEE IF THE TERM BY TERM DIFFERENCES, MULTIPLIED BY SFAC, ARE
  526. * NEGLIGIBLE.
  527. *
  528. * C. L. LAWSON, JPL, 1974 DEC 10
  529. *
  530. * .. Parameters ..
  531. INTEGER NOUT
  532. PARAMETER (NOUT=6)
  533. * .. Scalar Arguments ..
  534. REAL SFAC
  535. INTEGER LEN
  536. * .. Array Arguments ..
  537. REAL SCOMP(LEN), SSIZE(LEN), STRUE(LEN)
  538. * .. Scalars in Common ..
  539. INTEGER ICASE, INCX, INCY, MODE, N
  540. LOGICAL PASS
  541. * .. Local Scalars ..
  542. REAL SD
  543. INTEGER I
  544. * .. External Functions ..
  545. REAL SDIFF
  546. EXTERNAL SDIFF
  547. * .. Intrinsic Functions ..
  548. INTRINSIC ABS
  549. * .. Common blocks ..
  550. COMMON /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
  551. * .. Executable Statements ..
  552. *
  553. DO 40 I = 1, LEN
  554. SD = SCOMP(I) - STRUE(I)
  555. IF (SDIFF(ABS(SSIZE(I))+ABS(SFAC*SD),ABS(SSIZE(I))).EQ.0.0E0)
  556. + GO TO 40
  557. *
  558. * HERE SCOMP(I) IS NOT CLOSE TO STRUE(I).
  559. *
  560. IF ( .NOT. PASS) GO TO 20
  561. * PRINT FAIL MESSAGE AND HEADER.
  562. PASS = .FALSE.
  563. WRITE (NOUT,99999)
  564. WRITE (NOUT,99998)
  565. 20 WRITE (NOUT,99997) ICASE, N, INCX, INCY, MODE, I, SCOMP(I),
  566. + STRUE(I), SD, SSIZE(I)
  567. 40 CONTINUE
  568. RETURN
  569. *
  570. 99999 FORMAT (' FAIL')
  571. 99998 FORMAT (/' CASE N INCX INCY MODE I ',
  572. + ' COMP(I) TRUE(I) DIFFERENCE',
  573. + ' SIZE(I)',/1X)
  574. 99997 FORMAT (1X,I4,I3,3I5,I3,2E36.8,2E12.4)
  575. END
  576. SUBROUTINE STEST1(SCOMP1,STRUE1,SSIZE,SFAC)
  577. * ************************* STEST1 *****************************
  578. *
  579. * THIS IS AN INTERFACE SUBROUTINE TO ACCOMODATE THE FORTRAN
  580. * REQUIREMENT THAT WHEN A DUMMY ARGUMENT IS AN ARRAY, THE
  581. * ACTUAL ARGUMENT MUST ALSO BE AN ARRAY OR AN ARRAY ELEMENT.
  582. *
  583. * C.L. LAWSON, JPL, 1978 DEC 6
  584. *
  585. * .. Scalar Arguments ..
  586. REAL SCOMP1, SFAC, STRUE1
  587. * .. Array Arguments ..
  588. REAL SSIZE(*)
  589. * .. Local Arrays ..
  590. REAL SCOMP(1), STRUE(1)
  591. * .. External Subroutines ..
  592. EXTERNAL STEST
  593. * .. Executable Statements ..
  594. *
  595. SCOMP(1) = SCOMP1
  596. STRUE(1) = STRUE1
  597. CALL STEST(1,SCOMP,STRUE,SSIZE,SFAC)
  598. *
  599. RETURN
  600. END
  601. REAL FUNCTION SDIFF(SA,SB)
  602. * ********************************* SDIFF **************************
  603. * COMPUTES DIFFERENCE OF TWO NUMBERS. C. L. LAWSON, JPL 1974 FEB 15
  604. *
  605. * .. Scalar Arguments ..
  606. REAL SA, SB
  607. * .. Executable Statements ..
  608. SDIFF = SA - SB
  609. RETURN
  610. END
  611. SUBROUTINE CTEST(LEN,CCOMP,CTRUE,CSIZE,SFAC)
  612. * **************************** CTEST *****************************
  613. *
  614. * C.L. LAWSON, JPL, 1978 DEC 6
  615. *
  616. * .. Scalar Arguments ..
  617. REAL SFAC
  618. INTEGER LEN
  619. * .. Array Arguments ..
  620. COMPLEX CCOMP(LEN), CSIZE(LEN), CTRUE(LEN)
  621. * .. Local Scalars ..
  622. INTEGER I
  623. * .. Local Arrays ..
  624. REAL SCOMP(20), SSIZE(20), STRUE(20)
  625. * .. External Subroutines ..
  626. EXTERNAL STEST
  627. * .. Intrinsic Functions ..
  628. INTRINSIC AIMAG, REAL
  629. * .. Executable Statements ..
  630. DO 20 I = 1, LEN
  631. SCOMP(2*I-1) = REAL(CCOMP(I))
  632. SCOMP(2*I) = AIMAG(CCOMP(I))
  633. STRUE(2*I-1) = REAL(CTRUE(I))
  634. STRUE(2*I) = AIMAG(CTRUE(I))
  635. SSIZE(2*I-1) = REAL(CSIZE(I))
  636. SSIZE(2*I) = AIMAG(CSIZE(I))
  637. 20 CONTINUE
  638. *
  639. CALL STEST(2*LEN,SCOMP,STRUE,SSIZE,SFAC)
  640. RETURN
  641. END
  642. SUBROUTINE ITEST1(ICOMP,ITRUE)
  643. * ********************************* ITEST1 *************************
  644. *
  645. * THIS SUBROUTINE COMPARES THE VARIABLES ICOMP AND ITRUE FOR
  646. * EQUALITY.
  647. * C. L. LAWSON, JPL, 1974 DEC 10
  648. *
  649. * .. Parameters ..
  650. INTEGER NOUT
  651. PARAMETER (NOUT=6)
  652. * .. Scalar Arguments ..
  653. INTEGER ICOMP, ITRUE
  654. * .. Scalars in Common ..
  655. INTEGER ICASE, INCX, INCY, MODE, N
  656. LOGICAL PASS
  657. * .. Local Scalars ..
  658. INTEGER ID
  659. * .. Common blocks ..
  660. COMMON /COMBLA/ICASE, N, INCX, INCY, MODE, PASS
  661. * .. Executable Statements ..
  662. IF (ICOMP.EQ.ITRUE) GO TO 40
  663. *
  664. * HERE ICOMP IS NOT EQUAL TO ITRUE.
  665. *
  666. IF ( .NOT. PASS) GO TO 20
  667. * PRINT FAIL MESSAGE AND HEADER.
  668. PASS = .FALSE.
  669. WRITE (NOUT,99999)
  670. WRITE (NOUT,99998)
  671. 20 ID = ICOMP - ITRUE
  672. WRITE (NOUT,99997) ICASE, N, INCX, INCY, MODE, ICOMP, ITRUE, ID
  673. 40 CONTINUE
  674. RETURN
  675. *
  676. 99999 FORMAT (' FAIL')
  677. 99998 FORMAT (/' CASE N INCX INCY MODE ',
  678. + ' COMP TRUE DIFFERENCE',
  679. + /1X)
  680. 99997 FORMAT (1X,I4,I3,3I5,2I36,I12)
  681. END