rename a_pid_fuzzy_equ to a_fuzzy_equ
[liba.git] / include / a / poly.h
blob2782edbb8aa6a08da5bd45d5dbab943c5f3177e2
1 /*!
2 @file poly.h
3 @brief polynomial
4 */
6 #ifndef LIBA_POLY_H
7 #define LIBA_POLY_H
9 #include "a.h"
11 /*!
12 @ingroup A
13 @addtogroup A_POLY polynomial
17 #if defined(__cplusplus)
18 extern "C" {
19 #endif /* __cplusplus */
20 #if defined(LIBA_POLY_C)
21 #undef A_INTERN
22 #define A_INTERN A_INLINE
23 #endif /* LIBA_POLY_C */
25 /*!
26 @brief swap between \f$ \sum_{i=0}^{n}a_{i}x^{i} \f$ and \f$ \sum_{i=0}^{n}a_{i}x^{n-i} \f$
28 A_EXTERN a_float *a_poly_swap(a_float *a, a_size n);
30 /*!
31 @brief horner function for polynomial \f$ \sum_{i=0}^{n}a_{i}x^{i} \f$
32 \f[
33 \left\{\begin{array}{l}
34 S_n = a_n\\
35 S_i = xS_{i+1} + a_i,\quad(i=n-1,n-2,\cdots,1,0)\\
36 P(x) = S_0
37 \end{array}\right.
38 \f]
40 #if !defined A_HAVE_INLINE || defined(LIBA_POLY_C)
41 A_EXTERN a_float a_poly_eval(a_float const *a, a_size n, a_float x);
42 #endif /* A_HAVE_INLINE */
43 A_EXTERN a_float a_poly_eval_(a_float const *a, a_float const *b, a_float x);
44 #if defined(A_HAVE_INLINE) || defined(LIBA_POLY_C)
45 A_INTERN a_float a_poly_eval(a_float const *a, a_size n, a_float x)
47 return n ? a_poly_eval_(a, a + n, x) : 0;
49 #endif /* A_HAVE_INLINE */
51 /*!
52 @brief horner function for polynomial \f$ \sum_{i=0}^{n}a_{i}x^{n-i} \f$
53 \f[
54 \left\{\begin{array}{l}
55 S_0 = a_0\\
56 S_i = xS_{i-1} + a_i,\quad(i=1,2,\cdots,n-1,n)\\
57 P(x) = S_n
58 \end{array}\right.
59 \f]
61 #if !defined A_HAVE_INLINE || defined(LIBA_POLY_C)
62 A_EXTERN a_float a_poly_evar(a_float const *a, a_size n, a_float x);
63 #endif /* A_HAVE_INLINE */
64 A_EXTERN a_float a_poly_evar_(a_float const *a, a_float const *b, a_float x);
65 #if defined(A_HAVE_INLINE) || defined(LIBA_POLY_C)
66 A_INTERN a_float a_poly_evar(a_float const *a, a_size n, a_float x)
68 return n ? a_poly_evar_(a, a + n, x) : 0;
70 #endif /* A_HAVE_INLINE */
72 #if defined(LIBA_POLY_C)
73 #undef A_INTERN
74 #define A_INTERN static A_INLINE
75 #endif /* LIBA_POLY_C */
76 #if defined(__cplusplus)
77 } /* extern "C" */
78 #endif /* __cplusplus */
80 /*! @} A_POLY */
82 #endif /* a/poly.h */