E.V.E
v2022.03.00

◆ negatenz

eve::negatenz = {}
inlineconstexpr

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

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value T, eve::value U >
eve::common_compatible_t<T, U> negatenz(T x, U y) noexcept;
}
constexpr callable_negatenz_ negatenz
Computes the elementwise product of the first parameter by the never zero sign of the second.
Definition: negatenz.hpp:63
Definition: all_of.hpp:22

Parameters

Return value

The elementwise product of the first parameter by the never zero sign of the second is returned.

Example

#include <eve/module/core.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;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers

  • Masked Call

    The call eve::negatenz[mask](x, ...) provides a masked version of negatenz which is equivalent to if_else(mask, negatenz(x, ...), x) Example