31#if defined(LagrangeInterpolation_RECURSES)
32#error Recursive header files inclusion detected in LagrangeInterpolation.h
35#define LagrangeInterpolation_RECURSES
37#if !defined LagrangeInterpolation_h
39#define LagrangeInterpolation_h
44#include "DGtal/base/Common.h"
45#include "DGtal/math/MPolynomial.h"
46#include "DGtal/kernel/NumberTraits.h"
47#include "DGtal/kernel/CEuclideanRing.h"
61 template <
typename TEucl
ideanRing>
68 typedef TEuclideanRing
Ring;
148 void init(
const std::vector< Ring >& xvalues )
168 P *= mmonomial<Ring>( 1 ) -
myX[ m ] * mmonomial<Ring>( 0 );
185 if ( yvalues.size() != size() )
return P;
201 ASSERT( 0 <= i && i <
size() );
214 that_stream <<
"[LagrangeInterpolation det=" <<
myDeterminant << std::endl;
216 that_stream <<
"l_" << i <<
"=" <<
basis( i ) << std::endl;
247 template <
typename TEucl
ideanRing>
268#undef LagrangeInterpolation_RECURSES
Aim: This class implements Lagrange basis functions and Lagrange interpolation.
Polynomial polynomial(const std::vector< Ring > &yvalues)
LagrangeInterpolation(const std::vector< Ring > &xvalues)
BOOST_CONCEPT_ASSERT((concepts::CEuclideanRing< Ring >))
LagrangeInterpolation(LagrangeInterpolation &&other)=default
~LagrangeInterpolation()=default
LagrangeInterpolation< TEuclideanRing > Self
void selfDisplay(std::ostream &that_stream) const
std::vector< Polynomial > myLagrangeBasis
The Lagrange polynomial basis corresponding to X-values.
Polynomial basis(Size i) const
DGtal::MPolynomial< 1, Ring > Polynomial
The monovariate polynomial type.
Ring myDeterminant
The determinant of the Vandermonde matrix corresponding to X-values.
LagrangeInterpolation & operator=(const LagrangeInterpolation &other)=default
LagrangeInterpolation & operator=(LagrangeInterpolation &&other)=default
std::vector< Ring > myX
The vector of X-values (abscissa)
void init(const std::vector< Ring > &xvalues)
LagrangeInterpolation(const LagrangeInterpolation &other)=default
Aim: Represents a multivariate polynomial, i.e. an element of , where K is some ring or field.
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::uint32_t Dimension
Aim: The traits class for all models of Cinteger.
Aim: Defines the mathematical concept equivalent to a unitary commutative ring with a division operat...