E.V.E  0.1-beta

◆ negatenz

eve::negatenz = {}
inlineconstexpr

Callable object computing the negatenz function.

Required header: #include <eve/function/negatenz.hpp>

Members Functions

Member Effect
operator() the negatenz operation
operator[] Construct a conditional version of current function object

auto operator()( value auto x, value auto y ) const noexcept;
Definition: value.hpp:31

Parameters

x, y: values.

Return value

Returns the elementwise product of the first parameter by the never zero sign of the second.


auto operator[]( conditional_expression auto cond ) const noexcept;

Higher-order function generating a masked version of eve::negatenz

Parameters

cond : conditional expression

Return value

A Callable object so that the expression negatenz[cond](x, ...) is equivalent to if_else(cond,negatenz(x, ...),x)


Supported decorators

: Required header: #include <eve/function/diff/negatenz.hpp>

The expression `diff(negatenz)(x)` computes the derivative of the function relative to `x`.

no decorators are supported

Example

See it live on Compiler Explorer

#include <eve/function/negatenz.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, -0.0f, 0.0f, -2.0f, 2.0f, -2.0f, 2.0f, -2.0f};
wide_ft qf = {4.0f, 4.0f, -4.0f, -4.0, 0.0f, 0.0f, -0.0f, -0.0f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- qf = " << qf << '\n'
<< "-> negatenz(pf, qf) = " << eve::negatenz(pf, qf) << '\n';
float xf = 4.0f;
float yf = -0.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
<< "-> negatenz(xf, yf) = " << eve::negatenz(xf, yf) << '\n';
return 0;
}
constexpr callable_negatenz_ negatenz
Callable object computing the negatenz function.
Definition: negatenz.hpp:78
Wrapper for SIMD registers.
Definition: wide.hpp:65