Alexandria  2.19
Please provide a description of the project.
Polynomial.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2021 Euclid Science Ground Segment
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 3.0 of the License, or (at your option)
7  * any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
25 #ifndef MATHUTILS_POLYNOMIAL_H
26 #define MATHUTILS_POLYNOMIAL_H
27 
28 #include <vector>
29 
30 #include "ElementsKernel/Export.h"
31 
34 
35 namespace Euclid {
36 namespace MathUtils {
37 
44 
45 public:
53  explicit Polynomial(std::vector<double> coefficients);
54 
56  virtual ~Polynomial() = default;
57 
59  const std::vector<double>& getCoefficients() const;
60 
62  double operator()(const double) const override;
63 
65  std::unique_ptr<Function> clone() const override;
66 
68  std::shared_ptr<Function> derivative() const override;
69 
71  std::shared_ptr<Function> indefiniteIntegral() const override;
72 
73 private:
77  mutable std::shared_ptr<Function> m_derivative{};
79  mutable std::shared_ptr<Function> m_indefIntegral{};
80 
81 }; // End of Polynomial
82 
83 } // namespace MathUtils
84 } // end of namespace Euclid
85 
86 #endif /* MATHUTILS_POLYNOMIAL_H */
Differentiable.h
std::shared_ptr
STL class.
Export.h
Euclid::MathUtils::derivative
double derivative(const Function &f, const double x)
Definition: FiniteDifference.cpp:41
Euclid::MathUtils::Differentiable
Interface representing a differentiable function.
Definition: Differentiable.h:49
std::vector< double >
Euclid::MathUtils::Polynomial
Represents a polynomial function.
Definition: Polynomial.h:43
ELEMENTS_API
#define ELEMENTS_API
Euclid::MathUtils::Polynomial::m_coef
std::vector< double > m_coef
The vector where the polynomial coefficients are stored.
Definition: Polynomial.h:75
Euclid::MathUtils::Polynomial::~Polynomial
virtual ~Polynomial()=default
Default destructor.
Function.h
std::unique_ptr
STL class.
Euclid
Definition: InstOrRefHolder.h:29