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

◆ tchebytchev

auto eve::tchebytchev = functor<tchebytchev_t>
inlineconstexpr
  • The Tchebytchev polynomial of order n is given by \( \displaystyle \mbox{T}_{n}(x) = \cos(n\arccos(x))\) on \([-1, +1]\)

Header file

#include <eve/module/polynomial.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto tchebytchev(integral_value auto n, floating_value auto x) noexcept; // 1
// Lanes masking
constexpr auto tchebytchev[conditional_expr auto c](integral_value auto n, floating_value auto x) noexcept; // 2
constexpr auto tchebytchev[logical_value auto m](integral_value auto n, floating_value auto x) noexcept; // 2
// Semantic options
constexpr auto tchebytchev[kind_1](integral_value auto n, floating_value auto x) noexcept; // 1
constexpr auto tchebytchev[kind_2](integral_value auto n, floating_value auto x) noexcept; // 3
constexpr auto tchebytchev[successor](floating_value auto x, integral_value auto tn,
integral_value auto tnm1) noexcept; // 4
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:116
The concept integral_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:51
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:134
constexpr auto tchebytchev
Computes the value of the Tchebytchev polynomial of order n at x:
Definition tchebytchev.hpp:100
EVE Main Namespace.
Definition abi.hpp:19

Parameters

Return value

1.The value of the polynomial at x is returned.

  1. The operation is performed conditionally.
  2. evaluates the nth polynomial of tchebytchev of second kind \( \displaystyle U_n(x) = \frac{\sin(n\arccos x)}{\sin(\arccos x)}\). on \([-1, +1]\).
  3. computes the value of \(T_{n+1}(x)\) knowing the values tn = \(T_n(x)\) and tnm1 = \(T_{n-1}(x)\), This call can be used to create a sequence of values evaluated at the same x and for rising n.

External references

Example

// revision 1
#include <eve/module/polynomial.hpp>
#include <iostream>
int main()
{
eve::wide xd{0.5, -1.5, 0.1, -1.0, 19.0, 25.0, 21.5, 10000.0};
eve::wide n{0, 1, 2, 3, 4, 5, 6, 7};
eve::wide n1{0, -1, -2, -3, -4, -5, -6, -7};
double x(0.5);
std::cout << "<- xd = " << xd << '\n';
std::cout << "<- n = " << n << '\n';
std::cout << "<- x = " << x << '\n';
std::cout << "-> tchebytchev(n, xd) = " << eve::tchebytchev(n, xd) << '\n';
std::cout << "-> tchebytchev[eve::ignore_last(2)](n, xd) = " << eve::tchebytchev[eve::ignore_last(2)](n, xd) << '\n';
std::cout << "-> tchebytchev[n > 3](n, xd) = " << eve::tchebytchev[n > 3](n, xd) << '\n';
std::cout << "-> tchebytchev(3, xd) = " << eve::tchebytchev(3, xd) << '\n';
std::cout << "-> tchebytchev(n, 2.0) = " << eve::tchebytchev(n, 2.0) << '\n';
std::cout << "-> tchebytchev(n, x) = " << eve::tchebytchev(n, x) << '\n';
std::cout << "-> tchebytchev[kind_2](n, xd) = " << eve::tchebytchev[eve::kind_2](n, xd) << "\n\n";
using wide_ft = decltype(xd);
std::array<wide_ft, 8> t;
t[0] = eve::tchebytchev(0, xd);
std::cout << "-> t[0] = " << t[0] << '\n';
std::cout << "-> tchebytchev(" << 0 << ", xd) = " << eve::tchebytchev(0, xd) << '\n';
t[1] = eve::tchebytchev(1, xd);
std::cout << "-> t[1] = " << t[1] << '\n';
std::cout << "-> tchebytchev(" << 1 << ", xd) = " << eve::tchebytchev(1, xd) << '\n';
for(int i = 2; i <= 7; ++i)
{
t[i] = eve::tchebytchev[eve::successor](xd, t[i-1], t[i-2]);
std::cout << "-> t[" << i << "] = " << t[i] << '\n';
std::cout << "-> tchebytchev(" << i << ", xd) = " << eve::tchebytchev(i, xd) << '\n';
}
}
Conditional expression ignoring the k last lanes from a eve::simd_value.
Definition conditional.hpp:361
Wrapper for SIMD registers.
Definition wide.hpp:94