1 #include <gsl/gsl_test.h>
2 #include <gsl/gsl_ieee_utils.h>
3 #include <gsl/gsl_math.h>
4 #include <gsl/gsl_cblas.h>
10 const double flteps = 1e-4, dbleps = 1e-6;
14 float X[] = { 0.733f };
15 float Y[] = { 0.825f };
18 float expected = 0.604725f;
20 f = cblas_sdsdot (N, alpha, X, incX, Y, incY);
21 gsl_test_rel(f, expected, flteps, "sdsdot(case 1)");
28 float X[] = { 0.733f };
29 float Y[] = { 0.825f };
32 float expected = 0.704725f;
34 f = cblas_sdsdot (N, alpha, X, incX, Y, incY);
35 gsl_test_rel(f, expected, flteps, "sdsdot(case 2)");
42 float X[] = { 0.733f };
43 float Y[] = { 0.825f };
46 float expected = 1.604725f;
48 f = cblas_sdsdot (N, alpha, X, incX, Y, incY);
49 gsl_test_rel(f, expected, flteps, "sdsdot(case 3)");
56 float X[] = { -0.812f };
57 float Y[] = { -0.667f };
60 float expected = 0.541604f;
62 f = cblas_sdsdot (N, alpha, X, incX, Y, incY);
63 gsl_test_rel(f, expected, flteps, "sdsdot(case 4)");
70 float X[] = { -0.812f };
71 float Y[] = { -0.667f };
74 float expected = 0.641604f;
76 f = cblas_sdsdot (N, alpha, X, incX, Y, incY);
77 gsl_test_rel(f, expected, flteps, "sdsdot(case 5)");
84 float X[] = { -0.812f };
85 float Y[] = { -0.667f };
88 float expected = 1.541604f;
90 f = cblas_sdsdot (N, alpha, X, incX, Y, incY);
91 gsl_test_rel(f, expected, flteps, "sdsdot(case 6)");
98 float X[] = { 0.481f };
99 float Y[] = { 0.523f };
102 float expected = 0.251563f;
104 f = cblas_sdsdot (N, alpha, X, incX, Y, incY);
105 gsl_test_rel(f, expected, flteps, "sdsdot(case 7)");
112 float X[] = { 0.481f };
113 float Y[] = { 0.523f };
116 float expected = 0.351563f;
118 f = cblas_sdsdot (N, alpha, X, incX, Y, incY);
119 gsl_test_rel(f, expected, flteps, "sdsdot(case 8)");
126 float X[] = { 0.481f };
127 float Y[] = { 0.523f };
130 float expected = 1.251563f;
132 f = cblas_sdsdot (N, alpha, X, incX, Y, incY);
133 gsl_test_rel(f, expected, flteps, "sdsdot(case 9)");
139 float X[] = { 0.785f };
140 float Y[] = { -0.7f };
143 float expected = -0.5495f;
145 f = cblas_sdot(N, X, incX, Y, incY);
146 gsl_test_rel(f, expected, flteps, "sdot(case 10)");
152 double X[] = { 0.79 };
153 double Y[] = { -0.679 };
156 double expected = -0.53641;
158 f = cblas_ddot(N, X, incX, Y, incY);
159 gsl_test_rel(f, expected, dbleps, "ddot(case 11)");
165 float X[] = { 0.474f, -0.27f };
166 float Y[] = { -0.144f, -0.392f };
169 float expected[2] = {-0.174096f, -0.146928f};
171 cblas_cdotu_sub(N, X, incX, Y, incY, &f);
172 gsl_test_rel(f[0], expected[0], flteps, "cdotu(case 12) real");
173 gsl_test_rel(f[1], expected[1], flteps, "cdotu(case 12) imag");
179 float X[] = { 0.474f, -0.27f };
180 float Y[] = { -0.144f, -0.392f };
183 float expected[2] = {0.037584f, -0.224688f};
185 cblas_cdotc_sub(N, X, incX, Y, incY, &f);
186 gsl_test_rel(f[0], expected[0], flteps, "cdotc(case 13) real");
187 gsl_test_rel(f[1], expected[1], flteps, "cdotc(case 13) imag");
193 double X[] = { -0.87, -0.631 };
194 double Y[] = { -0.7, -0.224 };
197 double expected[2] = {0.467656, 0.63658};
199 cblas_zdotu_sub(N, X, incX, Y, incY, &f);
200 gsl_test_rel(f[0], expected[0], dbleps, "zdotu(case 14) real");
201 gsl_test_rel(f[1], expected[1], dbleps, "zdotu(case 14) imag");
207 double X[] = { -0.87, -0.631 };
208 double Y[] = { -0.7, -0.224 };
211 double expected[2] = {0.750344, -0.24682};
213 cblas_zdotc_sub(N, X, incX, Y, incY, &f);
214 gsl_test_rel(f[0], expected[0], dbleps, "zdotc(case 15) real");
215 gsl_test_rel(f[1], expected[1], dbleps, "zdotc(case 15) imag");
221 float X[] = { -0.457f };
222 float Y[] = { 0.839f };
225 float expected = -0.383423f;
227 f = cblas_sdot(N, X, incX, Y, incY);
228 gsl_test_rel(f, expected, flteps, "sdot(case 16)");
234 double X[] = { 0.949 };
235 double Y[] = { -0.873 };
238 double expected = -0.828477;
240 f = cblas_ddot(N, X, incX, Y, incY);
241 gsl_test_rel(f, expected, dbleps, "ddot(case 17)");
247 float X[] = { 0.852f, -0.045f };
248 float Y[] = { 0.626f, -0.164f };
251 float expected[2] = {0.525972f, -0.167898f};
253 cblas_cdotu_sub(N, X, incX, Y, incY, &f);
254 gsl_test_rel(f[0], expected[0], flteps, "cdotu(case 18) real");
255 gsl_test_rel(f[1], expected[1], flteps, "cdotu(case 18) imag");
261 float X[] = { 0.852f, -0.045f };
262 float Y[] = { 0.626f, -0.164f };
265 float expected[2] = {0.540732f, -0.111558f};
267 cblas_cdotc_sub(N, X, incX, Y, incY, &f);
268 gsl_test_rel(f[0], expected[0], flteps, "cdotc(case 19) real");
269 gsl_test_rel(f[1], expected[1], flteps, "cdotc(case 19) imag");
275 double X[] = { -0.786, -0.341 };
276 double Y[] = { -0.271, -0.896 };
279 double expected[2] = {-0.09253, 0.796667};
281 cblas_zdotu_sub(N, X, incX, Y, incY, &f);
282 gsl_test_rel(f[0], expected[0], dbleps, "zdotu(case 20) real");
283 gsl_test_rel(f[1], expected[1], dbleps, "zdotu(case 20) imag");
289 double X[] = { -0.786, -0.341 };
290 double Y[] = { -0.271, -0.896 };
293 double expected[2] = {0.518542, 0.611845};
295 cblas_zdotc_sub(N, X, incX, Y, incY, &f);
296 gsl_test_rel(f[0], expected[0], dbleps, "zdotc(case 21) real");
297 gsl_test_rel(f[1], expected[1], dbleps, "zdotc(case 21) imag");
303 float X[] = { -0.088f };
304 float Y[] = { -0.165f };
307 float expected = 0.01452f;
309 f = cblas_sdot(N, X, incX, Y, incY);
310 gsl_test_rel(f, expected, flteps, "sdot(case 22)");
316 double X[] = { -0.434 };
317 double Y[] = { -0.402 };
320 double expected = 0.174468;
322 f = cblas_ddot(N, X, incX, Y, incY);
323 gsl_test_rel(f, expected, dbleps, "ddot(case 23)");
329 float X[] = { -0.347f, 0.899f };
330 float Y[] = { -0.113f, -0.858f };
333 float expected[2] = {0.810553f, 0.196139f};
335 cblas_cdotu_sub(N, X, incX, Y, incY, &f);
336 gsl_test_rel(f[0], expected[0], flteps, "cdotu(case 24) real");
337 gsl_test_rel(f[1], expected[1], flteps, "cdotu(case 24) imag");
343 float X[] = { -0.347f, 0.899f };
344 float Y[] = { -0.113f, -0.858f };
347 float expected[2] = {-0.732131f, 0.399313f};
349 cblas_cdotc_sub(N, X, incX, Y, incY, &f);
350 gsl_test_rel(f[0], expected[0], flteps, "cdotc(case 25) real");
351 gsl_test_rel(f[1], expected[1], flteps, "cdotc(case 25) imag");
357 double X[] = { -0.897, -0.204 };
358 double Y[] = { -0.759, 0.557 };
361 double expected[2] = {0.794451, -0.344793};
363 cblas_zdotu_sub(N, X, incX, Y, incY, &f);
364 gsl_test_rel(f[0], expected[0], dbleps, "zdotu(case 26) real");
365 gsl_test_rel(f[1], expected[1], dbleps, "zdotu(case 26) imag");
371 double X[] = { -0.897, -0.204 };
372 double Y[] = { -0.759, 0.557 };
375 double expected[2] = {0.567195, -0.654465};
377 cblas_zdotc_sub(N, X, incX, Y, incY, &f);
378 gsl_test_rel(f[0], expected[0], dbleps, "zdotc(case 27) real");
379 gsl_test_rel(f[1], expected[1], dbleps, "zdotc(case 27) imag");