MBSim |
Project Page |
class for piecewise-polynomials and cubic spline interpolation More...
#include <piecewise_polynom_function.h>
Classes | |
| class | FirstDerivative |
| piecewise polynomial interpolation - first derivative More... | |
| class | SecondDerivative |
| piecewise polynomial interpolation - second derivative More... | |
| class | ZerothDerivative |
| piecewise polynomial interpolation - zeroth derivative More... | |
Public Types | |
| enum | InterpolationMethod { cSplinePeriodic, cSplineNatural, piecewiseLinear } |
Public Member Functions | |
| Ret | operator() (const Arg &x) |
| fmatvec::Der< Ret, Arg >::type | parDer (const Arg &x) |
|
fmatvec::Der< typename fmatvec::Der< Ret, double > ::type, double >::type | parDerParDer (const double &x) |
| void | setXF (const fmatvec::VecV &x, const fmatvec::MatV &f, InterpolationMethod method=cSplineNatural) |
| set interpolation | |
| std::vector< fmatvec::MatV > | getCoefs () |
| fmatvec::VecV | getBreaks () |
| void | setPP (const std::vector< fmatvec::MatV > &coefs_u, const fmatvec::Vec &breaks_u) |
| set piecewise polynomial | |
| virtual void | initializeUsingXML (xercesc::DOMElement *element) |
| initialize function with XML code | |
Protected Member Functions | |
| void | calculateSplinePeriodic (const fmatvec::VecV &x, const fmatvec::MatV &f) |
| calculation of periodic spline by interpolation | |
| void | calculateSplineNatural (const fmatvec::VecV &x, const fmatvec::MatV &f) |
| calculation of natural spline by interpolation | |
| void | calculatePLinear (const fmatvec::VecV &x, const fmatvec::MatV &f) |
Protected Attributes | |
| std::vector< fmatvec::MatV > | coefs |
| vector of polynomial coefficents | |
| fmatvec::Vec | breaks |
| vector of breaks (interval boundaries) | |
| int | nPoly |
| number of defined piecewise polynomials | |
| int | order |
| order of polynomial (3 for cubic polynomials) | |
| int | index |
| for internal use in ppeval functions | |
Private Attributes | |
| ZerothDerivative | f |
| FirstDerivative | fd |
| SecondDerivative | fdd |
class for piecewise-polynomials and cubic spline interpolation
Spline / PP-Form info Piecewise polynomial:
with [c0 c1 c2 ... cn] ith row vector of coefs-matrix breaks(i) << x << breaks(i+1) defines i and xloc = x-breaks(i)
Ex. cubic spline with breaks= [0; 0.3; 0.5] coefs= [d1 c1 b1 a1; d2 c2 b2 a2]
Cubic spline (xi,fi) i=1..N is being interpolated by N-1 piecewise polynomials Si of degree 3 yielding a global
curve for uniqueness TWO additional boundary conditions are necessary (periodic / natural)
Piecewise linear polynomial (xi,fi) i=1..N is being interpolated by N-1 piecewise polynomials Si of degree 1 yielding a globally weak differentiable curve in the context of this class the second derivative is defined to be zero everywhere (which is mathematically wrong)
| void MBSim::PiecewisePolynomFunction< Ret(Arg)>::calculateSplineNatural | ( | const fmatvec::VecV & | x, |
| const fmatvec::MatV & | f | ||
| ) | [protected] |
calculation of natural spline by interpolation
| interpolated | arguments |
| interpolated | function values |
| void MBSim::PiecewisePolynomFunction< Ret(Arg)>::calculateSplinePeriodic | ( | const fmatvec::VecV & | x, |
| const fmatvec::MatV & | f | ||
| ) | [protected] |
calculation of periodic spline by interpolation
| interpolated | arguments |
| interpolated | function values |
| fmatvec::VecV MBSim::PiecewisePolynomFunction< Ret(Arg)>::getBreaks | ( | ) | [inline] |
| std::vector<fmatvec::MatV> MBSim::PiecewisePolynomFunction< Ret(Arg)>::getCoefs | ( | ) | [inline] |
| void MBSim::PiecewisePolynomFunction< Ret(Arg)>::initializeUsingXML | ( | xercesc::DOMElement * | element | ) | [virtual] |
initialize function with XML code
| XML | element |
| void MBSim::PiecewisePolynomFunction< Ret(Arg)>::setPP | ( | const std::vector< fmatvec::MatV > & | coefs_u, |
| const fmatvec::Vec & | breaks_u | ||
| ) | [inline] |
set piecewise polynomial
| polynomial | coefficients |
| interval | boundaries |
| void MBSim::PiecewisePolynomFunction< Ret(Arg)>::setXF | ( | const fmatvec::VecV & | x, |
| const fmatvec::MatV & | f, | ||
| InterpolationMethod | method = cSplineNatural |
||
| ) | [inline] |
set interpolation
| x | vector of ordered x values |
| f | corresponding f(x) values (rowwise) |
| InterpolationMethod | 'cSplinePeriodic' -> cubic Spline with periodic end conditions (two-times continuously differentiable) S(x1) = S(xN) -> f(0)=f(end) S'(x1) = S'(xN) S''(x1) = S''(xN) 'cSplineNatural' -> cubic Spline with natural end conditions (two-times continuously differentiable) S''(x1) = S''(xN) = 0 'piecewiseLinear' -> piecewise linear function (weak differentiable) |
1.8.0