liba 0.1.15
An algorithm library based on C/C++
Loading...
Searching...
No Matches
tf.h
Go to the documentation of this file.
1
6#ifndef LIBA_TF_H
7#define LIBA_TF_H
8
9#include "a.h"
10
17typedef struct a_tf a_tf;
18
19#if defined(__cplusplus)
20namespace a
21{
22typedef struct a_tf tf;
23} /* namespace a */
24extern "C" {
25#endif /* __cplusplus */
26
34A_EXTERN void a_tf_set_num(a_tf *ctx, unsigned int num_n, a_float const *num_p, a_float *input);
35
43A_EXTERN void a_tf_set_den(a_tf *ctx, unsigned int den_n, a_float const *den_p, a_float *output);
44
55A_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);
58
65A_EXTERN a_float a_tf_iter(a_tf const *ctx, a_float x);
66
71A_EXTERN void a_tf_zero(a_tf const *ctx);
72
73#if defined(__cplusplus)
74} /* extern "C" */
75#endif /* __cplusplus */
76
80struct a_tf
81{
84 a_float const *num_p;
85 a_float const *den_p;
86 unsigned int num_n;
87 unsigned int den_n;
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_)
91 {
92 a_tf_init(this, num_n_, num_p_, input_, den_n_, den_p_, output_);
93 }
94 A_INLINE void set_num(unsigned int num_n_, a_float const *num_p_, a_float *input_)
95 {
96 a_tf_set_num(this, num_n_, num_p_, input_);
97 }
98 A_INLINE void set_den(unsigned int den_n_, a_float const *den_p_, a_float *output_)
99 {
100 a_tf_set_den(this, den_n_, den_p_, output_);
101 }
102 A_INLINE a_float operator()(a_float x) const
103 {
104 return a_tf_iter(this, x);
105 }
106 A_INLINE void zero() const { a_tf_zero(this); }
107#endif /* __cplusplus */
108};
109
112#endif /* a/tf.h */
algorithm library
#define a_float
Definition a.h:785
void a_tf_set_den(a_tf *ctx, unsigned int den_n, double const *den_p, double *output)
set denominator for transfer function
double a_tf_iter(a_tf const *ctx, double x)
calculate for transfer function
void a_tf_init(a_tf *ctx, unsigned int num_n, double const *num_p, double *input, unsigned int den_n, double const *den_p, double *output)
initialize for transfer function
void a_tf_set_num(a_tf *ctx, unsigned int num_n, double const *num_p, double *input)
set numerator for transfer function
void a_tf_zero(a_tf const *ctx)
zeroing for transfer function
instance structure for transfer function
Definition tf.h:81
unsigned int den_n
denominator number
Definition tf.h:87
unsigned int num_n
numerator number
Definition tf.h:86
double const * num_p
numerator
Definition tf.h:84
double * input
input
Definition tf.h:82
double * output
output
Definition tf.h:83
double const * den_p
denominator
Definition tf.h:85