liba 0.1.15
An algorithm library based on C/C++
 
Loading...
Searching...
No Matches
poly.h
Go to the documentation of this file.
1
5
6#ifndef LIBA_POLY_H
7#define LIBA_POLY_H
8
9#include "a.h"
10
16
17#if defined(__cplusplus)
18extern "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 */
24
28#if !defined A_HAVE_INLINE || defined(LIBA_POLY_C)
29A_EXTERN void a_poly_swap(a_float *a, a_size n);
30#endif /* A_HAVE_INLINE */
31A_EXTERN void a_poly_swap_(a_float *a, a_float *b);
32#if defined(A_HAVE_INLINE) || defined(LIBA_POLY_C)
33A_INTERN void a_poly_swap(a_float *a, a_size n)
34{
35 if (n > 1) { a_poly_swap_(a, a + n); }
36}
37#endif /* A_HAVE_INLINE */
38
49#if !defined A_HAVE_INLINE || defined(LIBA_POLY_C)
50A_EXTERN a_float a_poly_eval(a_float const *a, a_size n, a_float x);
51#endif /* A_HAVE_INLINE */
52A_EXTERN a_float a_poly_eval_(a_float const *a, a_float const *b, a_float x);
53#if defined(A_HAVE_INLINE) || defined(LIBA_POLY_C)
54A_INTERN a_float a_poly_eval(a_float const *a, a_size n, a_float x)
55{
56 return n ? a_poly_eval_(a, a + n, x) : 0;
57}
58#endif /* A_HAVE_INLINE */
59
70#if !defined A_HAVE_INLINE || defined(LIBA_POLY_C)
71A_EXTERN a_float a_poly_evar(a_float const *a, a_size n, a_float x);
72#endif /* A_HAVE_INLINE */
73A_EXTERN a_float a_poly_evar_(a_float const *a, a_float const *b, a_float x);
74#if defined(A_HAVE_INLINE) || defined(LIBA_POLY_C)
75A_INTERN a_float a_poly_evar(a_float const *a, a_size n, a_float x)
76{
77 return n ? a_poly_evar_(a, a + n, x) : 0;
78}
79#endif /* A_HAVE_INLINE */
80
81#if defined(LIBA_POLY_C)
82#undef A_INTERN
83#define A_INTERN static A_INLINE
84#endif /* LIBA_POLY_C */
85#if defined(__cplusplus)
86} /* extern "C" */
87#endif /* __cplusplus */
88
90
91#endif /* a/poly.h */
algorithm library
double a_float
compiler built-in floating-point number type
Definition a.h:1003
a_float a_poly_eval(a_float const *a, a_size n, a_float x)
horner function for polynomial
void a_poly_swap(a_float *a, a_size n)
swap between and
a_float a_poly_evar(a_float const *a, a_size n, a_float x)
horner function for polynomial
size_t a_size
unsigned integer type returned by the sizeof operator
Definition a.h:823