E.V.E
v2023.02.15
Loading...
Searching...
No Matches

◆ neville

auto eve::neville = functor<neville_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overloads
constexpr auto neville(auto x, auto const& xs..., auto const& ys...) noexcept; // 1
constexpr auto neville(auto x, eve::non_empty_product_type auto const& xx, eve::non_empty_product_type auto const& yy) noexcept; // 2
}
constexpr auto neville
callable computing the value of the interpolation polynomial of degree n, satisfying: for
Definition neville.hpp:88
EVE Main Namespace.
Definition abi.hpp:19

Parameters

Return value

  • 1. Return the value at x of the polynomial \(p\) of degree n, satisfying \(p(x_i) = y_i\) for \(i = 0..n\), where n+1 is the common number of xs, ys.
  • 2. Same as 1., using the tuple elements.

External references

// revision 1 TODO
#include <eve/module/math.hpp>
#include <iostream>
#include <iomanip>
int main()
{
{
kumi::tuple xd{1.0, 2.0};
kumi::tuple yd = kumi::map([](auto x){return 2*x+1; }, xd);
eve::wide<double, eve::fixed<4>> x(0.5, 2.0, -2.5, 5.0);
std::cout << "<- xd = " << xd << '\n';
std::cout << "<- yd = " << yd << '\n';
std::cout << "<- x = " << x << '\n';
std::cout << "-> neville(x, xd, yd) = " << eve::neville(x, 1.0, 2.0, 3.0, 5.0)<< '\n';
std::cout << "-> neville(x, xd, yd) = " << eve::neville(x, kumi::cat(xd, yd)) << '\n';
std::cout << "-> neville(x, xd, yd) = " << eve::neville(x, xd, yd) << '\n';
}
{
kumi::tuple xd{1.0, 2.0, 3.0, 4.0};
kumi::tuple yd = kumi::map([](auto x){return x*x; }, xd);
eve::wide<double, eve::fixed<8>> x(0.5, 2.0, -2.5, 5.0,0.5, 2.0, -2.5, 5.0 );
std::cout << "<- xd = " << xd << '\n';
std::cout << "<- yd = " << yd << '\n';
std::cout << "<- x = " << x << '\n';
std::cout << "-> neville(x, xd, yd) = " << eve::neville(x, 1.0, 2.0, 3.0, 4.0, 1.0, 4.0, 9.0, 16.0) << '\n';
std::cout << "-> neville(x, xd, yd) = " << eve::neville(x, kumi::cat(xd, yd)) << '\n';
std::cout << "-> neville(x, xd, yd) = " << eve::neville(x, xd, yd) << '\n';
}
}
constexpr cat_t cat
constexpr map_t map
Wrapper for SIMD registers.
Definition wide.hpp:94