E.V.E
v2023.02.15

◆ 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_value_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: abi.hpp:18
typename eve::detail::common_value_impl< void, Ts... >::type common_value_t
Computes the SIMD-compatible common type between all Ts.
Definition: common_value.hpp:50

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

    #include <eve/module/core.hpp>
    #include <eve/wide.hpp>
    #include <iostream>
    int main()
    {
    wide_ft pf = {0.0f, -0.0f, 0.0f, -0.0f, 2.0f, -2.0f, 2.0f, 2.0f};
    wide_ft qf = {4.0f, 4.0f, -4.0f, -4.0, 4.0f, 4.0f, -0.0f, +0.0f};
    std::cout << "---- simd" << '\n'
    << "<- pf = " << pf << '\n'
    << "<- qf = " << qf << '\n'
    << "-> negatenz[pf < qf](pf, qf) = " << eve::negatenz[pf < qf](pf, qf) << '\n';
    return 0;
    }