From 07e18043145f3d91c8ea7ec3ad41b3c905585277 Mon Sep 17 00:00:00 2001 From: Ethan Werner Date: Wed, 1 Jul 2026 09:42:39 +0400 Subject: initial commit: ts time series analysis library v0.1.0 - 354 financial and mathematical time-series indicators - Uniform C11 API with consistent function signatures - 349 passing tests with -Werror - Static and shared library builds - pkg-config integration - Python bindings - Fuzzing and sanitizer support - Security hardening flags --- test/fisher_transform.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/fisher_transform.c (limited to 'test/fisher_transform.c') diff --git a/test/fisher_transform.c b/test/fisher_transform.c new file mode 100644 index 0000000..050a360 --- /dev/null +++ b/test/fisher_transform.c @@ -0,0 +1,26 @@ +#include +#include +#include "ts.h" + +bool ts_test_fisher_transform( void ) +{ + /* k=3, prices increasing monotonically */ + fp_t const o[] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 }; + fp_t const h[] = { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }; + fp_t const l[] = { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }; + fp_t const c[] = { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; + + fp_t const * const x[] = { o, h, l, c }; + + /* Window indices [1..3], H=[13,14,15], L=[10,11,12], range=5, val=(14-10)/5=0.8 */ + /* fisher = 0.5*ln(0.8/0.2) + 0.5*0 = 0.5*ln(4) = 0.69315 */ + /* Next: H=[14,15,16], L=[11,12,13], val=(15-11)/5=0.8, fisher=0.5*ln(4)+0.5*0.69315=0.69315+0.34657=1.03972 */ + /* Monotonic, so all val=0.8, fisher converges toward ln(4) = 1.38629 */ + /* f1=0.69315, f2=1.03972, f3=1.21301, f4=1.29965, f5=1.34297, f6=1.36463, f7=1.37546 */ + fp_t const ef[] = { 0.69315, 1.03972, 1.21301, 1.29965, 1.34297, 1.36463, 1.37546, 1.38088, 0, 0 }; + fp_t const et[] = { 0, 0.69315, 1.03972, 1.21301, 1.29965, 1.34297, 1.36463, 1.37546, 0, 0 }; + fp_t const * const exp[2] = { ef, et }; + + uint_t k = 3; + return ts_test(ts_fisher_transform, ts_fisher_transform_offset, x, exp, sizeof( o ) / sizeof( *o ), (ts_constant_t *)&k, &ts_fisher_transform_p); +} -- cgit v1.3.1