E.V.E
v2022.03.00

◆ negate

eve::negate = {}
inlineconstexpr

Computes the elementwise product of the first parameter by the 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> negate(T x, U y) noexcept;
}
constexpr callable_negate_ negate
Computes the elementwise product of the first parameter by the sign of the second.
Definition: negate.hpp:63
Definition: all_of.hpp:22

Parameters

Return value

The elementwise product of the first parameter by the 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, -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'
<< "-> negate(pf, qf) = " << eve::negate(pf, qf) << '\n';
float xf = 4.0f;
float yf = -1.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
<< "-> negate(xf, yf) = " << eve::negate(xf, yf) << '\n';
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers

  • Masked Call

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