diff options
| author | Ethan Werner <mail@ethanwerner.com> | 2026-08-09 15:02:21 +0400 |
|---|---|---|
| committer | Ethan Werner <mail@ethanwerner.com> | 2026-08-09 15:02:21 +0400 |
| commit | 3d92926a902017e7cf1f5738e99ff62da596ce12 (patch) | |
| tree | 2b55422c26a48759d56fa91f06df24449e9dfa88 /lib/fractal_chaos_bands.c | |
| parent | 07e18043145f3d91c8ea7ec3ad41b3c905585277 (diff) | |
refactormain
Diffstat (limited to 'lib/fractal_chaos_bands.c')
| -rw-r--r-- | lib/fractal_chaos_bands.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/fractal_chaos_bands.c b/lib/fractal_chaos_bands.c index 57bbf00..1cbef90 100644 --- a/lib/fractal_chaos_bands.c +++ b/lib/fractal_chaos_bands.c @@ -22,7 +22,7 @@ ts_parameter_t const ts_fractal_chaos_bands_p = { .n_inputs = 4, .n_outputs = 2, uint_t ts_fractal_chaos_bands_offset( ts_constant_t const *c ) { ( void )c; - return ( c ? ((ts_fractal_chaos_bands_params_t *)c)->k / 2 : 0 ); + return ( c ? ((ts_fractal_chaos_bands_params_t const *)c)->k / 2 : 0 ); } int ts_fractal_chaos_bands( @@ -33,7 +33,8 @@ int ts_fractal_chaos_bands( { TS_PROLOGUE( ts_fractal_chaos_bands_p ); if ( !c ) return -1; - uint_t k = ((ts_fractal_chaos_bands_params_t *)c)->k; + TS_CHECK_INPUT(x, x_n, n); + uint_t k = ((ts_fractal_chaos_bands_params_t const *)c)->k; if (k == 0 || n < k) return -1; fp_t alpha = 2.0 / (k + 1.0); @@ -69,6 +70,13 @@ int ts_fractal_chaos_bands( y[0][i] = ema_upper; y[1][i] = ema_lower; } + + for ( uint_t i = n - half_k; i < n; ++i ) + { + y[0][i] = 0; + y[1][i] = 0; + } + return 0; } |