20#include <ql/math/interpolations/lagrangeinterpolation.hpp>
21#include <ql/math/interpolations/chebyshevinterpolation.hpp>
24 namespace chebyshev_interpolation_detail {
27 std::transform(std::begin(x), std::end(x), std::begin(t), f);
39 std::begin(
x_), std::end(
x_), std::begin(
y_)
48 chebyshev_interpolation_detail::apply(
63 for (
Size i=0; i < n; ++i)
64 t[i] = -std::cos((i+0.5)*M_PI/n);
67 for (
Size i=0; i < n; ++i)
68 t[i] = -std::cos(i*M_PI/(n-1));
71 QL_FAIL(
"unknonw Chebyshev interpolation points type");
77 QL_REQUIRE(y.size() ==
y_.
size(),
78 "interpolation override has the wrong length");
80 std::copy(y.begin(), y.end(),
y_.
begin());
1-D array used in linear algebra.
const Real * const_iterator
Size size() const
dimension of the array
const_iterator begin() const
ChebyshevInterpolation(const Array &y, PointsType pointsType=SecondKind)
void updateY(const Array &y)
ext::shared_ptr< Impl > impl_
std::size_t Size
size of a container
Array apply(const Array &x, const ext::function< Real(Real)> &f)