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

utest_main2.c 14 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. /*****************************************************************************
  2. Copyright (c) 2011-2016, The OpenBLAS Project
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are
  6. met:
  7. 1. Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. 2. Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in
  11. the documentation and/or other materials provided with the
  12. distribution.
  13. 3. Neither the name of the OpenBLAS project nor the names of
  14. its contributors may be used to endorse or promote products
  15. derived from this software without specific prior written
  16. permission.
  17. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  18. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  21. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  23. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  24. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  25. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  26. USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. **********************************************************************************/
  28. #include <stdio.h>
  29. #include <complex.h>
  30. #define CTEST_MAIN
  31. #define CTEST_SEGFAULT
  32. #define CTEST_ADD_TESTS_MANUALLY
  33. #include "openblas_utest.h"
  34. CTEST(amax, samax){
  35. blasint N=3, inc=1;
  36. float te_max=0.0, tr_max=0.0;
  37. float x[]={-1.1, 2.2, -3.3};
  38. te_max=BLASFUNC(samax)(&N, x, &inc);
  39. tr_max=3.3;
  40. ASSERT_DBL_NEAR_TOL((double)(tr_max), (double)(te_max), SINGLE_EPS);
  41. }
  42. CTEST (drotmg,rotmg)
  43. {
  44. double te_d1, tr_d1;
  45. double te_d2, tr_d2;
  46. double te_x1, tr_x1;
  47. double te_y1, tr_y1;
  48. double te_param[5];
  49. double tr_param[5];
  50. int i=0;
  51. // original test case for libGoto bug fixed by feb2014 rewrite
  52. te_d1= 0.21149573940783739;
  53. te_d2= 0.046892057172954082;
  54. te_x1= -0.42272687517106533;
  55. te_y1= 0.42211309121921659;
  56. for(i=0; i<5; i++){
  57. te_param[i]=tr_param[i]=0.0;
  58. }
  59. //reference values as calculated by netlib blas
  60. tr_d1= 0.1732048;
  61. tr_d2= 0.03840234;
  62. tr_x1= -0.516180;
  63. tr_y1= 0.422113;
  64. tr_d1= 0.17320483687975;
  65. tr_d2= 0.03840233915037;
  66. tr_x1= -0.51618034832329;
  67. tr_y1= 0.42211309121922;
  68. tr_param[0]= 0.0;
  69. tr_param[1]= 0.0;
  70. tr_param[2]= 0.99854803659786;
  71. tr_param[3]= -0.22139439665872;
  72. tr_param[4]= 0.0;
  73. BLASFUNC(drotmg)(&te_d1, &te_d2, &te_x1, &te_y1, te_param);
  74. ASSERT_DBL_NEAR_TOL(tr_d1, te_d1, DOUBLE_EPS);
  75. ASSERT_DBL_NEAR_TOL(tr_d2, te_d2, DOUBLE_EPS);
  76. ASSERT_DBL_NEAR_TOL(tr_x1, te_x1, DOUBLE_EPS);
  77. ASSERT_DBL_NEAR_TOL(tr_y1, te_y1, DOUBLE_EPS);
  78. for(i=0; i<5; i++){
  79. ASSERT_DBL_NEAR_TOL(tr_param[i], te_param[i], DOUBLE_EPS);
  80. }
  81. }
  82. CTEST (drotmg,rotmg_issue1452)
  83. {
  84. double te_d1, tr_d1;
  85. double te_d2, tr_d2;
  86. double te_x1, tr_x1;
  87. double te_y1, tr_y1;
  88. double te_param[5];
  89. double tr_param[5];
  90. int i=0;
  91. // from issue #1452
  92. te_d1 = 5.9e-8;
  93. te_d2 = 5.960464e-8;
  94. te_x1 = 1.0;
  95. te_y1 = 150.0;
  96. for(i=0; i<5; i++){
  97. te_param[i]=tr_param[i]=0.0;
  98. }
  99. te_param[3]=1./4096.;
  100. //reference values as calculated by gonum blas with rotmg rewritten to Hopkins' algorithm
  101. tr_d1= 0.99995592822897;
  102. tr_d2= 0.98981219860583;
  103. tr_x1= 0.03662270484346;
  104. tr_y1= 150.000000000000;
  105. tr_param[0]= -1.0;
  106. tr_param[1]= 0.00000161109346;
  107. tr_param[2]= -0.00024414062500;
  108. tr_param[3]= 0.00024414062500;
  109. tr_param[4]= 0.00000162760417;
  110. //OpenBLAS
  111. BLASFUNC(drotmg)(&te_d1, &te_d2, &te_x1, &te_y1, te_param);
  112. ASSERT_DBL_NEAR_TOL(tr_d1, te_d1, DOUBLE_EPS);
  113. ASSERT_DBL_NEAR_TOL(tr_d2, te_d2, DOUBLE_EPS);
  114. ASSERT_DBL_NEAR_TOL(tr_x1, te_x1, DOUBLE_EPS);
  115. ASSERT_DBL_NEAR_TOL(tr_y1, te_y1, DOUBLE_EPS);
  116. for(i=0; i<5; i++){
  117. ASSERT_DBL_NEAR_TOL(tr_param[i], te_param[i], DOUBLE_EPS);
  118. }
  119. }
  120. CTEST(drotmg, rotmg_D1eqD2_X1eqX2)
  121. {
  122. double te_d1, tr_d1;
  123. double te_d2, tr_d2;
  124. double te_x1, tr_x1;
  125. double te_y1, tr_y1;
  126. double te_param[5];
  127. double tr_param[5];
  128. int i=0;
  129. te_d1= tr_d1=2.;
  130. te_d2= tr_d2=2.;
  131. te_x1= tr_x1=8.;
  132. te_y1= tr_y1=8.;
  133. for(i=0; i<5; i++){
  134. te_param[i]=tr_param[i]=0.0;
  135. }
  136. //reference values as calculated by netlib blas
  137. tr_d1= 1.0;
  138. tr_d2= 1.0;
  139. tr_x1= 16.0;
  140. tr_y1= 8.0;
  141. tr_param[0]=1.0;
  142. tr_param[1]=1.0;
  143. tr_param[2]=0.0;
  144. tr_param[3]=0.0;
  145. tr_param[4]=1.0;
  146. //OpenBLAS
  147. BLASFUNC(drotmg)(&te_d1, &te_d2, &te_x1, &te_y1, te_param);
  148. ASSERT_DBL_NEAR_TOL(tr_d1, te_d1, DOUBLE_EPS);
  149. ASSERT_DBL_NEAR_TOL(tr_d2, te_d2, DOUBLE_EPS);
  150. ASSERT_DBL_NEAR_TOL(tr_x1, te_x1, DOUBLE_EPS);
  151. ASSERT_DBL_NEAR_TOL(tr_y1, te_y1, DOUBLE_EPS);
  152. for(i=0; i<5; i++){
  153. ASSERT_DBL_NEAR_TOL(tr_param[i], te_param[i], DOUBLE_EPS);
  154. }
  155. }
  156. CTEST(drotmg, drotmg_D1_big_D2_big_flag_zero)
  157. {
  158. double te_d1, tr_d1;
  159. double te_d2, tr_d2;
  160. double te_x1, tr_x1;
  161. double te_y1, tr_y1;
  162. double te_param[5]={1.,4096.,-4096.,1.,4096.};
  163. double tr_param[5]={-1.,4096.,-3584.,1792.,4096.};
  164. int i=0;
  165. te_d1= tr_d1=1600000000.;
  166. te_d2= tr_d2=800000000.;
  167. te_x1= tr_x1=8.;
  168. te_y1= tr_y1=7.;
  169. //reference values as calculated by gonum
  170. tr_d1= 68.96627824858757;
  171. tr_d2= 34.483139124293785;
  172. tr_x1= 45312.;
  173. tr_y1= 7.0;
  174. //OpenBLAS
  175. BLASFUNC(drotmg)(&te_d1, &te_d2, &te_x1, &te_y1, te_param);
  176. ASSERT_DBL_NEAR_TOL(tr_d1, te_d1, DOUBLE_EPS);
  177. ASSERT_DBL_NEAR_TOL(tr_d2, te_d2, DOUBLE_EPS);
  178. ASSERT_DBL_NEAR_TOL(tr_x1, te_x1, DOUBLE_EPS);
  179. ASSERT_DBL_NEAR_TOL(tr_y1, te_y1, DOUBLE_EPS);
  180. for(i=0; i<5; i++){
  181. ASSERT_DBL_NEAR_TOL(tr_param[i], te_param[i], DOUBLE_EPS);
  182. }
  183. }
  184. CTEST(axpy,daxpy_inc_0)
  185. {
  186. blasint i;
  187. blasint N=8,incX=0,incY=0;
  188. double a=0.25;
  189. double x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
  190. double y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
  191. double x2[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
  192. double y2[]={4.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
  193. //OpenBLAS
  194. BLASFUNC(daxpy)(&N,&a,x1,&incX,y1,&incY);
  195. for(i=0; i<N; i++){
  196. ASSERT_DBL_NEAR_TOL(x2[i], x1[i], DOUBLE_EPS);
  197. ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
  198. }
  199. }
  200. CTEST(axpy,zaxpy_inc_0)
  201. {
  202. blasint i;
  203. blasint N=4,incX=0,incY=0;
  204. double a[2]={0.25,0.5};
  205. double x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
  206. double y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
  207. double x2[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
  208. double y2[]={-3.0,9.0,6.0,8.0,2.0,4.0,6.0,8.0};
  209. //OpenBLAS
  210. BLASFUNC(zaxpy)(&N,a,x1,&incX,y1,&incY);
  211. for(i=0; i<2*N; i++){
  212. ASSERT_DBL_NEAR_TOL(x2[i], x1[i], DOUBLE_EPS);
  213. ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
  214. }
  215. }
  216. CTEST(axpy,saxpy_inc_0)
  217. {
  218. blasint i;
  219. blasint N=8,incX=0,incY=0;
  220. float a=0.25;
  221. float x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
  222. float y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
  223. float x2[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
  224. float y2[]={4.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
  225. //OpenBLAS
  226. BLASFUNC(saxpy)(&N,&a,x1,&incX,y1,&incY);
  227. for(i=0; i<N; i++){
  228. ASSERT_DBL_NEAR_TOL(x2[i], x1[i], DOUBLE_EPS);
  229. ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
  230. }
  231. }
  232. CTEST(axpy,caxpy_inc_0)
  233. {
  234. blasint i;
  235. blasint N=4,incX=0,incY=0;
  236. float a[2]={0.25,0.5};
  237. float x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
  238. float y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
  239. float x2[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
  240. float y2[]={-3.0,9.0,6.0,8.0,2.0,4.0,6.0,8.0};
  241. //OpenBLAS
  242. BLASFUNC(caxpy)(&N,a,x1,&incX,y1,&incY);
  243. for(i=0; i<2*N; i++){
  244. ASSERT_DBL_NEAR_TOL(x2[i], x1[i], DOUBLE_EPS);
  245. ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
  246. }
  247. }
  248. CTEST( zdotu,zdotu_n_1)
  249. {
  250. blasint N=1,incX=1,incY=1;
  251. double x1[]={1.0,1.0};
  252. double y1[]={1.0,2.0};
  253. openblas_complex_double result1=openblas_make_complex_double(0.0,0.0);
  254. openblas_complex_double result2=openblas_make_complex_double(-1.0,3.0);
  255. #ifdef RETURN_BY_STACK
  256. BLASFUNC(zdotu)(&result1,&N,x1,&incX,y1,&incY);
  257. #else
  258. result1=BLASFUNC(zdotu)(&N,x1,&incX,y1,&incY);
  259. #endif
  260. #ifdef OPENBLAS_COMPLEX_STRUCT
  261. ASSERT_DBL_NEAR_TOL(result2.real, result1.real, DOUBLE_EPS);
  262. ASSERT_DBL_NEAR_TOL(result2.imag, result1.imag, DOUBLE_EPS);
  263. #else
  264. ASSERT_DBL_NEAR_TOL(creal(result2), creal(result1), DOUBLE_EPS);
  265. ASSERT_DBL_NEAR_TOL(cimag(result2), cimag(result1), DOUBLE_EPS);
  266. #endif
  267. }
  268. CTEST(zdotu, zdotu_offset_1)
  269. {
  270. blasint N=1,incX=1,incY=1;
  271. double x1[]={1.0,2.0,3.0,4.0};
  272. double y1[]={5.0,6.0,7.0,8.0};
  273. openblas_complex_double result1=openblas_make_complex_double(0.0,0.0);
  274. openblas_complex_double result2=openblas_make_complex_double(-9.0,32.0);
  275. #ifdef RETURN_BY_STACK
  276. BLASFUNC(zdotu)(&result1,&N,x1+1,&incX,y1+1,&incY);
  277. #else
  278. result1=BLASFUNC(zdotu)(&N,x1+1,&incX,y1+1,&incY);
  279. #endif
  280. #ifdef OPENBLAS_COMPLEX_STRUCT
  281. ASSERT_DBL_NEAR_TOL(result2.real, result1.real, DOUBLE_EPS);
  282. ASSERT_DBL_NEAR_TOL(result2.imag, result1.imag, DOUBLE_EPS);
  283. #else
  284. ASSERT_DBL_NEAR_TOL(creal(result2), creal(result1), DOUBLE_EPS);
  285. ASSERT_DBL_NEAR_TOL(cimag(result2), cimag(result1), DOUBLE_EPS);
  286. #endif
  287. }
  288. CTEST(dsdot,dsdot_n_1)
  289. {
  290. float x= 0.172555164F;
  291. float y= -0.0138700781F;
  292. blasint incx=1;
  293. blasint incy=1;
  294. blasint n=1;
  295. double res1=0.0f, res2=-0.00239335360107;
  296. res1=BLASFUNC(dsdot)(&n, &x, &incx, &y, &incy);
  297. ASSERT_DBL_NEAR_TOL(res2, res1, DOUBLE_EPS);
  298. }
  299. CTEST(rot,drot_inc_0)
  300. {
  301. blasint i=0;
  302. blasint N=4,incX=0,incY=0;
  303. double c=0.25,s=0.5;
  304. double x1[]={1.0,3.0,5.0,7.0};
  305. double y1[]={2.0,4.0,6.0,8.0};
  306. double x2[]={-0.21484375000000,3.0,5.0,7.0};
  307. double y2[]={ 0.03906250000000,4.0,6.0,8.0};
  308. //OpenBLAS
  309. BLASFUNC(drot)(&N,x1,&incX,y1,&incY,&c,&s);
  310. for(i=0; i<N; i++){
  311. ASSERT_DBL_NEAR_TOL(x2[i], x1[i], DOUBLE_EPS);
  312. ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
  313. }
  314. }
  315. CTEST(rot,zdrot_inc_0)
  316. {
  317. blasint i=0;
  318. blasint N=4,incX=0,incY=0;
  319. double c=0.25,s=0.5;
  320. double x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
  321. double y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
  322. double x2[]={-0.21484375000000,-0.45703125000000 ,5.0,7.0,1.0,3.0,5.0,7.0};
  323. double y2[]={ 0.03906250000000, 0.17187500000000 ,6.0,8.0,2.0,4.0,6.0,8.0};
  324. //OpenBLAS
  325. BLASFUNC(zdrot)(&N,x1,&incX,y1,&incY,&c,&s);
  326. for(i=0; i<2*N; i++){
  327. ASSERT_DBL_NEAR_TOL(x2[i], x1[i], DOUBLE_EPS);
  328. ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
  329. }
  330. }
  331. CTEST(rot,srot_inc_0)
  332. {
  333. blasint i=0;
  334. blasint N=4,incX=0,incY=0;
  335. float c=0.25,s=0.5;
  336. float x1[]={1.0,3.0,5.0,7.0};
  337. float y1[]={2.0,4.0,6.0,8.0};
  338. float x2[]={-0.21484375000000,3.0,5.0,7.0};
  339. float y2[]={ 0.03906250000000,4.0,6.0,8.0};
  340. //OpenBLAS
  341. BLASFUNC(srot)(&N,x1,&incX,y1,&incY,&c,&s);
  342. for(i=0; i<N; i++){
  343. ASSERT_DBL_NEAR_TOL(x2[i], x1[i], SINGLE_EPS);
  344. ASSERT_DBL_NEAR_TOL(y2[i], y1[i], SINGLE_EPS);
  345. }
  346. }
  347. CTEST(rot, csrot_inc_0)
  348. {
  349. blasint i=0;
  350. blasint N=4,incX=0,incY=0;
  351. float c=0.25,s=0.5;
  352. float x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
  353. float y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
  354. float x2[]={-0.21484375000000,-0.45703125000000 ,5.0,7.0,1.0,3.0,5.0,7.0};
  355. float y2[]={ 0.03906250000000, 0.17187500000000 ,6.0,8.0,2.0,4.0,6.0,8.0};
  356. //OpenBLAS
  357. BLASFUNC(csrot)(&N,x1,&incX,y1,&incY,&c,&s);
  358. for(i=0; i<2*N; i++){
  359. ASSERT_DBL_NEAR_TOL(x2[i], x1[i], SINGLE_EPS);
  360. ASSERT_DBL_NEAR_TOL(y2[i], y1[i], SINGLE_EPS);
  361. }
  362. }
  363. CTEST(swap,dswap_inc_0)
  364. {
  365. blasint i=0;
  366. blasint N=4,incX=0,incY=0;
  367. double x1[]={1.0,3.0,5.0,7.0};
  368. double y1[]={2.0,4.0,6.0,8.0};
  369. double x2[]={1.0,3.0,5.0,7.0};
  370. double y2[]={2.0,4.0,6.0,8.0};
  371. //OpenBLAS
  372. BLASFUNC(dswap)(&N,x1,&incX,y1,&incY);
  373. for(i=0; i<N; i++){
  374. ASSERT_DBL_NEAR_TOL(x2[i], x1[i], DOUBLE_EPS);
  375. ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
  376. }
  377. }
  378. CTEST(swap,zswap_inc_0)
  379. {
  380. blasint i=0;
  381. blasint N=4,incX=0,incY=0;
  382. double x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
  383. double y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
  384. double x2[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
  385. double y2[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
  386. //OpenBLAS
  387. BLASFUNC(zswap)(&N,x1,&incX,y1,&incY);
  388. for(i=0; i<2*N; i++){
  389. ASSERT_DBL_NEAR_TOL(x2[i], x1[i], DOUBLE_EPS);
  390. ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
  391. }
  392. }
  393. CTEST(swap,sswap_inc_0)
  394. {
  395. blasint i=0;
  396. blasint N=4,incX=0,incY=0;
  397. float x1[]={1.0,3.0,5.0,7.0};
  398. float y1[]={2.0,4.0,6.0,8.0};
  399. float x2[]={1.0,3.0,5.0,7.0};
  400. float y2[]={2.0,4.0,6.0,8.0};
  401. //OpenBLAS
  402. BLASFUNC(sswap)(&N,x1,&incX,y1,&incY);
  403. for(i=0; i<N; i++){
  404. ASSERT_DBL_NEAR_TOL(x2[i], x1[i], SINGLE_EPS);
  405. ASSERT_DBL_NEAR_TOL(y2[i], y1[i], SINGLE_EPS);
  406. }
  407. }
  408. CTEST(swap,cswap_inc_0)
  409. {
  410. blasint i=0;
  411. blasint N=4,incX=0,incY=0;
  412. float x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
  413. float y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
  414. float x2[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
  415. float y2[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
  416. //OpenBLAS
  417. BLASFUNC(cswap)(&N,x1,&incX,y1,&incY);
  418. for(i=0; i<2*N; i++){
  419. ASSERT_DBL_NEAR_TOL(x2[i], x1[i], SINGLE_EPS);
  420. ASSERT_DBL_NEAR_TOL(y2[i], y1[i], SINGLE_EPS);
  421. }
  422. }
  423. int main(int argc, const char ** argv){
  424. CTEST_ADD(amax, samax);
  425. CTEST_ADD (drotmg,rotmg);
  426. CTEST_ADD (drotmg,rotmg_issue1452);
  427. CTEST_ADD (drotmg,rotmg_D1eqD2_X1eqX2);
  428. CTEST_ADD (drotmg,drotmg_D1_big_D2_big_flag_zero);
  429. CTEST_ADD (axpy,daxpy_inc_0);
  430. CTEST_ADD (axpy,zaxpy_inc_0);
  431. CTEST_ADD (axpy,saxpy_inc_0);
  432. CTEST_ADD (axpy,caxpy_inc_0);
  433. CTEST_ADD (zdotu,zdotu_n_1);
  434. CTEST_ADD (zdotu,zdotu_offset_1);
  435. CTEST_ADD (dsdot,dsdot_n_1);
  436. CTEST_ADD (rot,drot_inc_0);
  437. CTEST_ADD (rot,zdrot_inc_0);
  438. CTEST_ADD (rot,srot_inc_0);
  439. CTEST_ADD (rot,csrot_inc_0);
  440. CTEST_ADD (swap,dswap_inc_0);
  441. CTEST_ADD (swap,zswap_inc_0);
  442. CTEST_ADD (swap,sswap_inc_0);
  443. CTEST_ADD (swap,cswap_inc_0);
  444. int num_fail=0;
  445. num_fail=ctest_main(argc, argv);
  446. return num_fail;
  447. }