liba 0.1.15
An algorithm library based on C/C++
Loading...
Searching...
No Matches
Collaboration diagram for polynomial:

Functions

void a_poly_swap (a_real *a, a_size n)
 swap between \( \sum_{i=0}^{n}a_{i}x^{i} \) and \( \sum_{i=0}^{n}a_{i}x^{n-i} \)
void a_poly_swap_ (a_real *a, a_real *b)
a_real a_poly_eval (a_real const *a, a_size n, a_real x)
 horner function for polynomial \( \sum_{i=0}^{n}a_{i}x^{i} \)
a_real a_poly_eval_ (a_real const *a, a_real const *b, a_real x)
a_real a_poly_evar (a_real const *a, a_size n, a_real x)
 horner function for polynomial \( \sum_{i=0}^{n}a_{i}x^{n-i} \)
a_real a_poly_evar_ (a_real const *a, a_real const *b, a_real x)
void a_poly_xTx (a_uint m, a_real const *x, a_uint n, a_real *A)
 compute the matrix A^T * A for polynomial fitting.
void a_poly_xTy (a_uint m, a_real const *x, a_real const *y, a_uint n, a_real *b)
 compute the vector A^T * y for polynomial fitting.

Detailed Description

Function Documentation

◆ a_poly_eval()

a_real a_poly_eval ( a_real const * a,
a_size n,
a_real x )

horner function for polynomial \( \sum_{i=0}^{n}a_{i}x^{i} \)

\[ \left\{\begin{array}{l} S_n = a_n\\ S_i = xS_{i+1} + a_i,\quad(i=n-1,n-2,\cdots,1,0)\\ P(x) = S_0 \end{array}\right. \]

◆ a_poly_evar()

a_real a_poly_evar ( a_real const * a,
a_size n,
a_real x )

horner function for polynomial \( \sum_{i=0}^{n}a_{i}x^{n-i} \)

\[ \left\{\begin{array}{l} S_0 = a_0\\ S_i = xS_{i-1} + a_i,\quad(i=1,2,\cdots,n-1,n)\\ P(x) = S_n \end{array}\right. \]

◆ a_poly_xTx()

void a_poly_xTx ( a_uint m,
a_real const * x,
a_uint n,
a_real * A )

compute the matrix A^T * A for polynomial fitting.

This function computes the product of the transpose of a design matrix A with itself (A^T * A), which is used in the normal equations for polynomial fitting using least squares method. The matrix A is implicitly defined by the input vector x, where each element of x corresponds to a data point.

Parameters
[in]mnumber of data points (rows in matrix A).
[in]xpoints to an array of size m containing the data points.
[in]ndegree of the polynomial plus one (columns in matrix A).
[out]Apoints to an array of size n*n where the result A^T * A will be stored.

◆ a_poly_xTy()

void a_poly_xTy ( a_uint m,
a_real const * x,
a_real const * y,
a_uint n,
a_real * b )

compute the vector A^T * y for polynomial fitting.

This function computes the product of the transpose of a design matrix A with a vector y (A^T * y), which is used in the normal equations for polynomial fitting using least squares method. The matrix A is implicitly defined by the input vector x, where each element of x corresponds to a data point.

Parameters
[in]mnumber of data points (rows in matrix A).
[in]xpoints to an array of size m containing the data points.
[in]ypoints to an array of size m containing the target values.
[in]ndegree of the polynomial plus one (columns in matrix A).
[out]bpoints to an array of size n where the result A^T * y will be stored.