summaryrefslogtreecommitdiffstats
path: root/lib/natr.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/natr.c')
-rw-r--r--lib/natr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/natr.c b/lib/natr.c
index ce58bb1..724e068 100644
--- a/lib/natr.c
+++ b/lib/natr.c
@@ -25,7 +25,7 @@ ts_parameter_t const ts_natr_p = { .n_inputs = 4, .n_outputs = 1, .n_constants =
uint_t ts_natr_offset( ts_constant_t const *c )
{
( void )c;
- return ( c ? ((ts_natr_params_t *)c)->k : 0 );
+ return ( c ? ((ts_natr_params_t const *)c)->k : 0 );
}
int ts_natr(
@@ -36,10 +36,14 @@ int ts_natr(
{
TS_PROLOGUE( ts_natr_p );
if ( !c ) return -1;
- uint_t k = ((ts_natr_params_t *)c)->k;
+ TS_CHECK_INPUT(x, x_n, n);
+ uint_t k = ((ts_natr_params_t const *)c)->k;
if (k == 0) return -1;
if (n < k + 1) return -1;
+ for( uint_t i = 0; i < k; ++i )
+ y[0][i] = NAN;
+
for( uint_t i = k; i < n; ++i )
{
fp_t tr_sum = 0;