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

◆ hermite

auto eve::hermite = functor<hermite_t>
inlineconstexpr

The physicists Hermite polynomials are a sequence of orthogonal polynomials relative to \(e^{-x^2}\) on the \([-\infty, +\infty]\) interval satisfying the following recurrence relation:

  • \( \mathbf{H}_0(x) = 1\).
  • \( \mathbf{H}_1(x) = 2x\).
  • \( \mathbf{H}_n(x) = 2x\mathbf{H}_{n-1}(x) -2(n-1)\mathbf{H}_{n-2}x\).

Callable Signatures

#include <eve/module/polynomial.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto hermite(integral_value auto n, floating_value auto x) noexcept; //1
// Lanes masking
constexpr auto hermite[conditional_expr auto c](integral_value auto n, floating_value auto x) noexcept; // 2
constexpr auto hermite[logical_value auto m](integral_value auto n, floating_value auto x) noexcept; // 2
// Semantic option
constexpr auto hermite(integral_value auto n, floating_value auto x,
floating_value auto hn, floating_value auto hnm1) noexcept; // 3
}
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 hermite
strict_elementwise_callable object computing the value of the 'physicists' Hermite polynomial of orde...
Definition hermite.hpp:108
EVE Main Namespace.
Definition abi.hpp:19

Parameters

Return value

  1. The value of the 'physicists' hermite polynomial \( \displaystyle \mathbf{H}_n(x) = (-1)^n e^{x^2}\frac{d}{dx^n}e^{-x^2}\) is returned.
  2. The operation is performed conditionally.
  3. implements the three terms recurrence relation for the physicists Hermite polynomials, \(\displaystyle \mbox{H}_{n+1} = (2*x)\mbox{H}_{n}-2*n\mbox{H}_{n-1}\). This call can be used to create a sequence of values evaluated at the same x, and for rising n.

External references

Example

// revision 0
#include <eve/module/polynomial.hpp>
#include <iostream>
#include <array>
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 x(2.0);
std::cout << "<- xd = " << xd << "\n";
std::cout << "<- n = " << n << "\n";
std::cout << "-> hermite(n, xd) = " << eve::hermite(n, xd) << "\n";
std::cout << "-> hermite[ignore_last(2)](n, xd) = " << eve::hermite[eve::ignore_last(2)](n, xd) << "\n";
std::cout << "-> hermite[n != 4](n, xd) = " << eve::hermite[n != 4](n, xd) << "\n\n";
using wide_ft = decltype(xd);
std::array<wide_ft, 8> h;
h[0] = eve::hermite(0, xd);
std::cout << "-> h[0] = " << h[0] << '\n';
std::cout << "-> hermite(" << 0 << ", xd) = " << eve::hermite(0, xd) << '\n';
h[1] = eve::hermite(1, xd);
std::cout << "-> hermite(" << 1 << ", xd) = " << eve::hermite(1, xd) << '\n';
std::cout << "-> h[1] = " << h[1] << '\n';
for(int i = 2; i <= 7; ++i)
{
h[i] = eve::hermite[eve::successor](i-1, xd, h[i-1], h[i-2]);
std::cout << "-> h[" << i << "] = " << h[i] << '\n';
std::cout << "-> hermite(" << i << ", xd) = " << eve::hermite(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