44 for (
size_t i = 0; i < c1.
size(); ++i)
45 for (
size_t j = 0; j < c2.
size(); ++j)
46 resultCoef[i + j] += c1[i] * c2[j];
64 auto p1Iter = knots1.
begin();
65 auto p2Iter = knots2.
begin();
67 while (p1Iter != knots1.
end() && p2Iter != knots2.
end()) {
69 if (*p1Iter < *p2Iter) {
71 if (p1Iter != knots1.
end() && *p1Iter > *p2Iter) {
76 if (p2Iter != knots2.
end() && *p1Iter < *p2Iter) {
82 if (*p1Iter < *p2Iter) {
83 knotSet.insert(*p1Iter);
86 knotSet.insert(*p2Iter);
109 for (
double knot : knots) {
110 if (knot == knots.back()) {
113 while (p1.
getKnots()[i1 + 1] <= knot) {
116 while (p2.
getKnots()[i2 + 1] <= knot) {
Interface class representing a function with an arbitrary number of parameters.
const std::vector< double > & getKnots() const
Returns the knots of the piecewise function.
Represents a piecewise function.
const std::vector< std::unique_ptr< Function > > & getFunctions() const
Returns the functions in the ranges between the knots.
Represents a polynomial function.
const std::vector< double > & getCoefficients() const
Returns the coefficients of the polynomial.
std::vector< double > overlappingKnots(const std::vector< double > &knots1, const std::vector< double > &knots2)
Returns a vector of the overlapping knots from the given vectors.
ELEMENTS_API std::map< std::pair< std::type_index, std::type_index >, MultiplyFunction > multiplySpecificSpecificMap
std::unique_ptr< Function >(* MultiplyFunction)(const Function &, const Function &)
Alias of a function which multiplies Function objects.
ELEMENTS_API std::map< std::type_index, MultiplyFunction > multiplySpecificGenericMap
std::unique_ptr< Function > multiplyPolynomials(const Function &f1, const Function &f2)
Function for multiplying two Polynomials. It multiplies their coefficients.
std::unique_ptr< Function > multiplyPiecewiseWithGeneric(const Function &f1, const Function &f2)
std::unique_ptr< Function > multiplyPiecewises(const Function &f1, const Function &f2)
ELEMENTS_API std::unique_ptr< Function > multiply(const Function &f1, const Function &f2)