diff options
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; } |