3 void a_tf_set_num(a_tf
*ctx
, unsigned int num_n
, a_float
const *num_p
, a_float
*input
)
8 a_zero(ctx
->input
, sizeof(a_float
) * ctx
->num_n
);
11 void a_tf_set_den(a_tf
*ctx
, unsigned int den_n
, a_float
const *den_p
, a_float
*output
)
16 a_zero(ctx
->output
, sizeof(a_float
) * ctx
->den_n
);
19 void a_tf_init(a_tf
*ctx
,
20 unsigned int num_n
, a_float
const *num_p
, a_float
*input
,
21 unsigned int den_n
, a_float
const *den_p
, a_float
*output
)
23 a_tf_set_num(ctx
, num_n
, num_p
, input
);
24 a_tf_set_den(ctx
, den_n
, den_p
, output
);
27 a_float
a_tf_iter(a_tf
const *ctx
, a_float x
)
30 a_float_push(ctx
->input
, ctx
->num_n
, &x
, 1);
31 for (unsigned int i
= 0; i
!= ctx
->num_n
; ++i
)
33 y
+= ctx
->num_p
[i
] * ctx
->input
[i
];
35 for (unsigned int i
= 0; i
!= ctx
->den_n
; ++i
)
37 y
-= ctx
->den_p
[i
] * ctx
->output
[i
];
39 a_float_push(ctx
->output
, ctx
->den_n
, &y
, 1);
43 void a_tf_zero(a_tf
const *ctx
)
45 a_zero(ctx
->input
, sizeof(a_float
) * ctx
->num_n
);
46 a_zero(ctx
->output
, sizeof(a_float
) * ctx
->den_n
);