E.V.E
v2023.02.15
Loading...
Searching...
No Matches
◆
heaviside
auto eve::heaviside =
functor
<heaviside_t>
inline
constexpr
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
}
eve::conditional_expr
Specifies that a type is a Conditional Expression.
Definition
conditional.hpp:28
eve::logical_value
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition
value.hpp:134
eve::value
The concept value<T> is satisfied if and only if T satisfies either eve::scalar_value or eve::simd_va...
Definition
value.hpp:34
eve::heaviside
constexpr auto heaviside
elementwise_callable that return 1 if the input is greater than a threshold else 0.
Definition
heaviside.hpp:92
eve
EVE Main Namespace.
Definition
abi.hpp:19
Parameters
x
: value.
s
: shift.
c
:
Conditional expression
masking the operation.
m
:
Logical value
masking the operation.
Return value
Each
element
of the result contains:
0
, if
x
is less or equal to zero.
1
otherwise.
Each
element
of the result contains:
0
, if
x
is less or equal to
s
(default to zero).
1
otherwise.
The operation is performed conditionnaly
.
External references
wikipedia
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'
;
}
eve::wide
Wrapper for SIMD registers.
Definition
wide.hpp:94
eve