Returns a logical true if and only if the element value are not equal.
Defined in Header
#include <eve/module/core.hpp>
{
template< eve::value T, eve::value U >
}
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
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
.
#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'
float xf = 1.0f;
float yf = 2.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
return 0;
}
Wrapper for SIMD registers.
Definition: wide.hpp:65
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
#include <eve/module/core.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
wide_ft pf = {0.0f, 1.0f, -1.0f,
eve::nan(
as(-2.0f))};
wide_ft qf = {1.0f, -1.0f, -1.0f,
eve::nan(as(-2.0f))};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- qf = " << qf << '\n'
float xf = 1.0f;
float yf = 2.0f;
std::cout << "---- scalar" << '\n'
<< "<- xf = " << xf << '\n'
<< "<- yf = " << yf << '\n'
return 0;
}
constexpr callable_nan_ nan
Computes the IEEE NaN constant.
Definition: nan.hpp:53
constexpr numeric_type const numeric
Higher-order Callable Object imbuing non invalid return preference semantic onto other Callable Objec...
Definition: numeric.hpp:53
Lightweight type-wrapper.
Definition: as.hpp:29
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};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- qf = " << qf << '\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