create a_linalg_dot
[liba.git] / test / poly.h
blobc489eff7285917656e035e4f7d94320cff407a63
1 #define MAIN(x) poly##x
2 #include "test.h"
3 #include "a/poly.h"
5 static void print_(a_float const *a, a_size n)
7 a_size i;
8 (void)putchar('{');
9 A_FORENUM(a_size, i, n)
11 printf("%" A_FLOAT_PRI "g", a[i]);
12 if (i < n - 1) { (void)putchar(','); }
14 (void)putchar('}');
17 int main(int argc, char *argv[]) /* NOLINT(misc-definitions-in-headers) */
19 a_float x = 2;
20 a_float x4[] = {A_FLOAT_C(1.0), A_FLOAT_C(2.0), A_FLOAT_C(3.0), A_FLOAT_C(4.0)};
21 print_(x4, 4);
22 printf("=%" A_FLOAT_PRI "g\n", a_poly_eval(x4, 4, x));
23 a_poly_swap(x4, 4);
24 print_(x4, 4);
25 printf("=%" A_FLOAT_PRI "g\n", a_poly_eval(x4, 4, x));
26 print_(x4, 4);
27 a_poly_swap(x4, 4);
28 printf("=%" A_FLOAT_PRI "g\n", a_poly_evar(x4, 4, x));
29 print_(x4, 3);
30 printf("=%" A_FLOAT_PRI "g\n", a_poly_eval(x4, 3, x));
31 a_poly_swap(x4, 3);
32 print_(x4, 3);
33 printf("=%" A_FLOAT_PRI "g\n", a_poly_eval(x4, 3, x));
34 print_(x4, 3);
35 printf("=%" A_FLOAT_PRI "g\n", a_poly_evar(x4, 3, x));
36 a_poly_swap(x4, 3);
37 (void)argc;
38 (void)argv;
39 return 0;