CbmRoot
|
Functions | |
constexpr size_t | NofPolCoefficients (size_t N, size_t M) |
Number of coefficients in a polynomial. | |
template<size_t N, typename T > | |
constexpr T | Horner (const T *c, const T &x) |
Horner's scheme for a 1D-polynomial estimation. | |
template<size_t N, typename T , typename... Args> | |
constexpr T | Horner (const T *c, const T &x1, Args... xI) |
Horner's scheme for a multidvariable polynomial estimation. | |
|
constexpr |
Horner's scheme for a 1D-polynomial estimation.
T | Underlying data type |
N | Degree of the polynomial |
c | Pointer to the first element of the polynomial coefficients |
x | Variable, for which the polynomial is to be estimated |
The polynomial coefficients are indexed as follows:
P<N>(x) = x * (... * (x * (x * c[0] + c[1]) + c[2]) + ...) + c[N] = c[0] * x^N + c[1] * x^(N-1) + ... + c[N - 1] * x + c[N]
|
constexpr |
Horner's scheme for a multidvariable polynomial estimation.
T | Underlying data type |
N | Degree of the polynomial |
c | Pointer to the first element of the polynomial coefficients |
x1 | First variable of the polynomial |
xI | Other variables: x2, ..., xM |
Example of the polynomial coefficient indexing for N = 4, M = 3:
P(x,y,z) = c[0] * x4 +
c[1] * x3y + c[2] * x3z + c[3] * x3 +
c[4] * x2y2 + c[5] * x2yz + c[6] * x2y + c[7] * x2z2 + c[8] * x2z + c[9] * x2 +
c[10] * xy3 + c[11] * xy2z + c[12] * xy2 + c[13] * xyz2 + c[14] * xyz + c[15] * xy + c[16] * xz3 + c[17] * xz2 + c[18] * xz + c[19] * x +
c[20] * y4 + c[21] * y3z + c[22] * y3 + c[23] * y2z2 + c[24] * y2z + c[25] * y2 + c[26] * yz3 + c[27] * yz2 + c[28] * yz + c[29] * y + c[30] * z4 + c[31] * z3 + c[32] * z2 + c[33] * z + c[34];
Definition at line 75 of file KfMath.h.
References Horner(), and NofPolCoefficients().
|
constexpr |
Number of coefficients in a polynomial.
N | Degree of the polynomial |
M | Number of dimensions |
Definition at line 19 of file KfMath.h.
References NofPolCoefficients().
Referenced by Horner(), and NofPolCoefficients().