Public Functions
float complex | polycf_val( |
int | polycf_fit( |
int | polycf_fit_lagrange( |
float complex | polycf_interp_lagrange( |
int | polycf_fit_lagrange_barycentric( |
float complex | polycf_val_lagrange_barycentric( |
int | polycf_expandbinomial( |
int | polycf_expandbinomial_pm( |
int | polycf_expandroots( |
int | polycf_expandroots2( |
int | polycf_findroots( |
int | polycf_findroots_durandkerner( |
int | polycf_findroots_bairstow( |
int | polycf_mul( |
Interfaces
float complex polycf_val(
Evaluate polynomial _p at value _x
- _p : polynomial coefficients, shape: (_k, 1)
- _k : polynomial coefficients length
- _x : input to evaluate polynomial
int polycf_fit(
Perform least-squares polynomial fit on data set
- _x : x-value sample set, shape: (_n, 1)
- _y : y-value sample set, shape: (_n, 1)
- _n : number of samples in _x and _y
- _p : polynomial coefficients output, shape: (_k, 1)
- _k : polynomial coefficients length
int polycf_fit_lagrange(
Perform Lagrange polynomial exact fit on data set
- _x : x-value sample set, size [_n x 1]
- _y : y-value sample set, size [_n x 1]
- _n : number of samples in _x and _y
- _p : polynomial coefficients output, shape: (_n, 1)
float complex polycf_interp_lagrange(
Perform Lagrange polynomial interpolation on data set without computing coefficients as an intermediate step.
- _x : x-value sample set, shape: (_n, 1)
- _y : y-value sample set, shape: (_n, 1)
- _n : number of samples in _x and _y
- _x0 : x-value to evaluate and compute interpolant
int polycf_fit_lagrange_barycentric(
Compute Lagrange polynomial fit in the barycentric form.
- _x : x-value sample set, size [_n x 1]
- _n : number of samples in _x
- _w : barycentric weights normalized so _w [0]=1, size [_n x 1]
float complex polycf_val_lagrange_barycentric(
Perform Lagrange polynomial interpolation using the barycentric form of the weights.
- _x : x-value sample set, shape: (_n, 1)
- _y : y-value sample set, shape: (_n, 1)
- _w : barycentric weights, shape: (_n, 1)
- _x0 : x-value to evaluate and compute interpolant
- _n : number of samples in _x, _y, and _w
int polycf_expandbinomial(
Perform binomial expansion on the polynomial \( P_n(x) = (1+x)^n \) as \( P_n(x) = p[0] + p[1]x + p[2]x^2 + ... + p[n]x^n \) NOTE: _p has order n (coefficients has length n+1)
- _n : polynomial order
- _p : polynomial coefficients, shape: (_n+1, 1)
int polycf_expandbinomial_pm(
Perform positive/negative binomial expansion on the polynomial \( P_n(x) = (1+x)^m (1-x)^k \) as \( P_n(x) = p[0] + p[1]x + p[2]x^2 + ... + p[n]x^n \) NOTE: _p has order n=m+k (array is length n+1)
- _m : number of '1+x' terms
- _k : number of '1-x' terms
- _p : polynomial coefficients, shape: (_m+_k+1, 1)
int polycf_expandroots(
Perform root expansion on the polynomial \( P_n(x) = (x-r[0]) (x-r[1]) ... (x-r[n-1]) \) as \( P_n(x) = p[0] + p[1]x + ... + p[n]x^n \) where \( r[0],r[1],...,r[n-1]\) are the roots of \( P_n(x) \). NOTE: _p has order _n (array is length _n+1)
- _r : roots of polynomial, shape: (_n, 1)
- _n : number of roots in polynomial
- _p : polynomial coefficients, shape: (_n+1, 1)
int polycf_expandroots2(
Perform root expansion on the polynomial \( P_n(x) = (xb[0]-a[0]) (xb[1]-a[1])...(xb[n-1]-a[n-1]) \) as \( P_n(x) = p[0] + p[1]x + ... + p[n]x^n \) NOTE: _p has order _n (array is length _n+1)
- _a : subtractant of polynomial rotos, shape: (_n, 1)
- _b : multiplicant of polynomial roots, shape: (_n, 1)
- _n : number of roots in polynomial
- _p : polynomial coefficients, shape: (_n+1, 1)
int polycf_findroots(
Find the complex roots of a polynomial.
- _poly :
- _n :
- _roots : resulting complex roots, shape: (_k-1, 1)
int polycf_findroots_durandkerner(
Find the complex roots of the polynomial using the Durand-Kerner method
- _p : polynomial coefficients, shape: (_n, 1)
- _k : polynomial length
- _roots : resulting complex roots, shape: (_k-1, 1)
int polycf_findroots_bairstow(
Find the complex roots of the polynomial using Bairstow's method.
- _p : polynomial coefficients, shape: (_n, 1)
- _k : polynomial length
- _roots : resulting complex roots, shape: (_k-1, 1)
int polycf_mul(
Expand the multiplication of two polynomials \( ( a[0] + a[1]x + a[2]x^2 + ...) (b[0] + b[1]x + b[]x^2 + ...) \) as \( c[0] + c[1]x + c[2]x^2 + ... + c[n]x^n \) where order(c) = order(a) + order(b) + 1 and therefore length(c) = length(a) + length(b) - 1
- _a : 1st polynomial coefficients (length is _order_a+1)
- _order_a : 1st polynomial order
- _b : 2nd polynomial coefficients (length is _order_b+1)
- _order_b : 2nd polynomial order
- _c : output polynomial, shape: (_order_a+_order_b+1, 1)