move python/src/a/*.pxi to python/src/a.pyx
[liba.git] / include / a / tf.h
blobfe9692c94e88d73aed5932361a46320f27a8bc24
1 /*!
2 @file tf.h
3 @brief transfer function
4 */
6 #ifndef LIBA_TF_H
7 #define LIBA_TF_H
9 #include "a.h"
11 /*!
12 @ingroup A
13 @addtogroup A_TF transfer function
17 typedef struct a_tf a_tf;
19 #if defined(__cplusplus)
20 namespace a
22 typedef struct a_tf tf;
23 } /* namespace a */
24 extern "C" {
25 #endif /* __cplusplus */
27 /*!
28 @brief set numerator for transfer function
29 @param[in,out] ctx points to an instance of transfer function
30 @param[in] num_n numerator number
31 @param[in] num_p numerator
32 @param[in] input input
34 A_EXTERN void a_tf_set_num(a_tf *ctx, unsigned int num_n, a_float const *num_p, a_float *input);
36 /*!
37 @brief set denominator for transfer function
38 @param[in,out] ctx points to an instance of transfer function
39 @param[in] den_n denominator number
40 @param[in] den_p denominator
41 @param[in] output output
43 A_EXTERN void a_tf_set_den(a_tf *ctx, unsigned int den_n, a_float const *den_p, a_float *output);
45 /*!
46 @brief initialize for transfer function
47 @param[in,out] ctx points to an instance of transfer function
48 @param[in] num_n numerator number
49 @param[in] num_p numerator
50 @param[in] input input
51 @param[in] den_n denominator number
52 @param[in] den_p denominator
53 @param[in] output output
55 A_EXTERN void a_tf_init(a_tf *ctx,
56 unsigned int num_n, a_float const *num_p, a_float *input,
57 unsigned int den_n, a_float const *den_p, a_float *output);
59 /*!
60 @brief calculate for transfer function
61 @param[in] ctx points to an instance of transfer function
62 @param[in] x transfer function input
63 @return transfer function output
65 A_EXTERN a_float a_tf_iter(a_tf const *ctx, a_float x);
67 /*!
68 @brief zeroing for transfer function
69 @param[in] ctx points to an instance of transfer function
71 A_EXTERN void a_tf_zero(a_tf const *ctx);
73 #if defined(__cplusplus)
74 } /* extern "C" */
75 #endif /* __cplusplus */
77 /*!
78 @brief instance structure for transfer function
80 struct a_tf
82 a_float *input; //!< input
83 a_float *output; //!< output
84 a_float const *num_p; //!< numerator
85 a_float const *den_p; //!< denominator
86 unsigned int num_n; //!< numerator number
87 unsigned int den_n; //!< denominator number
88 #if defined(__cplusplus)
89 A_INLINE void init(unsigned int _num_n, a_float const *_num_p, a_float *_input,
90 unsigned int _den_n, a_float const *_den_p, a_float *_output)
92 a_tf_init(this, _num_n, _num_p, _input, _den_n, _den_p, _output);
94 A_INLINE void set_num(unsigned int _num_n, a_float const *_num_p, a_float *_input)
96 a_tf_set_num(this, _num_n, _num_p, _input);
98 A_INLINE void set_den(unsigned int _den_n, a_float const *_den_p, a_float *_output)
100 a_tf_set_den(this, _den_n, _den_p, _output);
102 A_INLINE a_float operator()(a_float x) const
104 return a_tf_iter(this, x);
106 A_INLINE void zero() const { a_tf_zero(this); }
107 #endif /* __cplusplus */
110 /*! @} A_TF */
112 #endif /* a/tf.h */