1 #define MAIN_(x) A_CAST_2(x, _rbf)
7 int MAIN(int argc
, char *argv
[]) // NOLINT(misc-definitions-in-headers)
9 test_init(argc
, argv
, 1);
13 static a_float_t num
[] = {A_FLOAT_C(6.59492796e-05), A_FLOAT_C(6.54019884e-05)};
14 static a_float_t den
[] = {A_FLOAT_C(-1.97530991), A_FLOAT_C(0.97530991)};
15 static a_float_t input
[A_LEN(num
)];
16 static a_float_t output
[A_LEN(den
)];
17 a_tf_init(&tf
, A_LEN(num
), num
, input
, A_LEN(den
), den
, output
);
21 static a_float_t input
[2];
22 static a_float_t center
[10] = {-1, A_FLOAT_C(-0.5), 0, A_FLOAT_C(0.5), 1, -10, 5, 0, 5, 10};
23 static a_float_t height
[5] = {A_FLOAT_C(1.5), A_FLOAT_C(1.5), A_FLOAT_C(1.5), A_FLOAT_C(1.5), A_FLOAT_C(1.5)};
24 static a_float_t hidden
[5];
25 static a_float_t weight
[5];
26 static a_float_t deltaw
[5];
27 static a_float_t output
[1];
30 ctx
.center_p
= center
;
32 ctx
.height_p
= height
;
34 ctx
.hidden_p
= hidden
;
36 ctx
.output_p
= output
;
40 ctx
.learn
= A_FLOAT_C(0.5);
41 ctx
.alpha
= A_FLOAT_C(0.05);
45 for (unsigned int i
= 0; i
< 1000; ++i
)
47 ctx
.input_p
[0] = a_float_sin(A_FLOAT_C(0.002) * A_FLOAT_PI
* a_float_c(, i
));
48 ctx
.input_p
[1] = *tf
.output
;
49 a_rbf_tune(&ctx
, ctx
.input_p
);
50 a_tf_iter(&tf
, *a_rbf_iter(&ctx
));
51 debug(A_FLOAT_PRI("+", "f ") A_FLOAT_PRI("+", "f ") A_FLOAT_PRI("+", "f ") A_FLOAT_PRI("+", "f\n"),
52 A_FLOAT_C(0.002) * A_FLOAT_PI
* a_float_c(, i
), *ctx
.input_p
, *ctx
.output_p
, *tf
.output
);