25 #ifndef MATHUTILS_PIECEWISE_H
26 #define MATHUTILS_PIECEWISE_H
61 auto knotsBegin = m_knots.begin();
62 if (x < *knotsBegin) {
65 if (x == *knotsBegin) {
68 auto knotsEnd = m_knots.end();
70 return findX - knotsBegin;
115 double operator()(
const double)
const override;
132 double integrate(
const double x1,
const double x2)
const override;
ssize_t findKnot(double x) const
Interface representing an integrable function.
std::vector< std::unique_ptr< Function > > m_functions
A vector where the sub-functions are kept.
ELEMENTS_API double integrate(const Function &function, const double min, const double max, std::unique_ptr< NumericalIntegrationScheme > numericalIntegrationScheme=nullptr)
std::vector< double > m_knots
A vector where the knots are kept.
Represents a piecewise function.
const std::vector< double > & getKnots() const
Returns the knots of the piecewise function.
PiecewiseBase(std::vector< double > knots)
Represents a piecewise function.