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

◆ heaviside

auto eve::heaviside = functor<heaviside_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto heaviside(value auto x) noexcept; // 1
constexpr auto heaviside(value auto x, auto s) noexcept; // 2
// Lanes masking
constexpr auto heaviside[conditional_expr auto c](/*any of the above overloads*/) noexcept; // 3
constexpr auto heaviside[logical_value auto m](/*any of the above overloads*/) noexcept; // 3
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:132
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition value.hpp:34
constexpr auto heaviside
elementwise_callable that return 1 if the input is greater than a threshold else 0.
Definition heaviside.hpp:92
EVE Main Namespace.
Definition abi.hpp:18

Parameters

Return value

  1. Each element of the result contains:
    • 0, if x is less or equal to zero.
    • 1 otherwise.
  2. Each element of the result contains:
    • 0, if x is less or equal to s (default to zero).
    • 1 otherwise.
  3. The operation is performed conditionnaly.

External references

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
eve::wide x = {2.0, -3.0, 0.1, 4.0};
eve::wide s = {3.0, -4.0, -10.0, 0.0};
std::cout << " <- x = " << x << '\n';
std::cout << " <- s = " << s << '\n';
std::cout << " -> heaviside(x) = " << eve::heaviside(x) << '\n';
std::cout << " -> heaviside(x, s) = " << eve::heaviside(x, s) << '\n';
std::cout << " -> heaviside[x > -2](x) = " << eve::heaviside[x > -2](x, s) << '\n';
}
Wrapper for SIMD registers.
Definition wide.hpp:70