E.V.E
v2022.03.00

◆ is_not_equal

eve::is_not_equal = {}
inlineconstexpr

Returns a logical true if and only if the element value are not equal.

Defined in Header

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template< eve::value T, eve::value U >
auto is_not_equal(T x, U y) noexcept;
}
constexpr callable_is_not_equal_ is_not_equal
Returns a logical true if and only if the element value are not equal.
Definition: is_not_equal.hpp:95
Definition: all_of.hpp:22

Parameters

  • x, y : arguments

Return value

Returns the logical value containing the elementwise equality test result between x and y. The infix notation x != y can also be used.

Note
Although the infix notation with == is supported, the != operator on standard scalar types is the original one and so returns bool result, not eve::logical.

Example

#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, 1.0f, -1.0f, -2.0f};
wide_ft qf = {1.0f, -1.0f, -1.0f, -2.0f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- qf = " << qf << '\n'
<< "-> is_not_equal(pf, qf) = " << eve::is_not_equal(pf, qf) << '\n';
float xf = 1.0f;
float yf = 2.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
<< "-> is_not_equal(xf, yf) = " << eve::is_not_equal(xf, yf) << '\n';
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65

Semantic Modifiers

  • Masked Call

    The call eve::is_not_equal[mask](x) provides a masked version of eve::is_not_equal which is equivalent to `if_else (mask, is_not_equal(x, y), false_

    Example

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

eve::numeric

The expression numeric(is_not_equal)(x,y) considers that Nan values are not equal.

Example

  • definitely

    The expression definitely(is_not_equal)(x, y, t) where x and y must be floating point values, evals to true if and only if x is almost equal to y. This means that:

    • if t is a floating_value then the relative error of not confusing is x and y is greater than t \((|x-y| \ge t \max(|x|, |y|))\).
    • if t is a positive integral_value then there are more than t values of the type of x representable in the interval \([x,y[\).
    • if t is omitted then the tolerance t is taken to 3 times the machine \(\epsilon\) in the x type (3*eps(as(x))).

    Example

    #include <eve/module/core.hpp>
    #include <eve/wide.hpp>
    #include <iostream>
    int main()
    {
    wide_ft pf = {1.0f, 1.0f, -1.0f, -2.0f};
    wide_ft qf = {1.0f, -1.0f, -1.0f, -2.0f};
    pf += 3*eve::eps(eve::as<float>());
    std::cout << "---- simd" << '\n'
    << "<- pf = " << pf << '\n'
    << "<- qf = " << qf << '\n'
    << "-> is_not_equal)(pf, qf) = " << eve::is_not_equal(pf, qf) << '\n'
    << "-> definitely(is_not_equal)(pf, qf) = " << eve::definitely(eve::is_not_equal)(pf, qf) << '\n'
    << "-> definitely(is_not_equal)(pf, qf, 2) = " << eve::definitely(eve::is_not_equal)(pf, qf, 2) << '\n'
    << "-> definitely(is_not_equal)(pf, qf, 2.0f) = " << eve::definitely(eve::is_not_equal)(pf, qf, 2.0f) << '\n';
    return 0;
    }
    constexpr definitely_type const definitely
    Higher-order Callable Object imbuing a tolerant to small errors semantic onto other Callable Objects.
    Definition: fuzzy.hpp:104
    Lightweight type-wrapper.
    Definition: as.hpp:29