Namespaces
Variants
Actions

std::experimental::simd<T,Abi>::operator==,!=,<,<=,>,>=

From cppreference.com
< cpp‎ | experimental‎ | simd‎ | simd
 
 
Experimental
Filesystem library (filesystem TS)
Library fundamentals (library fundamentals TS)
Library fundamentals 2 (library fundamentals TS v2)
Library fundamentals 3 (library fundamentals TS v3)
Extensions for parallelism (parallelism TS)
Extensions for parallelism 2 (parallelism TS v2)
Extensions for concurrency (concurrency TS)
Extensions for concurrency 2 (concurrency TS v2)
Concepts (concepts TS)
Ranges (ranges TS)
Reflection (reflection TS)
Mathematical special functions (special functions TR)
 
 
 
 
friend simd_mask operator==( const simd& lhs, const simd& rhs ) noexcept;
(1) (parallelism TS v2)
friend simd_mask operator!=( const simd& lhs, const simd& rhs ) noexcept;
(2) (parallelism TS v2)
friend simd_mask operator<( const simd& lhs, const simd& rhs ) noexcept;
(3) (parallelism TS v2)
friend simd_mask operator<=( const simd& lhs, const simd& rhs ) noexcept;
(4) (parallelism TS v2)
friend simd_mask operator>( const simd& lhs, const simd& rhs ) noexcept;
(5) (parallelism TS v2)
friend simd_mask operator>=( const simd& lhs, const simd& rhs ) noexcept;
(6) (parallelism TS v2)

Applies the given comparison element-wise to each corresponding element of the operands. Returns a simd_mask such that for all i in the range of [0size() ) the ith element equals:

1) lhs[i] == rhs[i].
2) lhs[i] != rhs[i].
3) lhs[i] <  rhs[i].
4) lhs[i] <= rhs[i].
5) lhs[i] >  rhs[i].
6) lhs[i] >= rhs[i].

[edit] Parameters

lhs - left operands
rhs - right operands

[edit] Example

Run this code
#include <cassert>
#include <iostream>
#include <initializer_list>
#include <iterator>
 
#include <experimental/simd>
namespace stdx = std::experimental;
 
int main()
{
 using V = stdx::fixed_size_simd<int, 4>;
 using M = stdx::fixed_size_simd_mask<int, 4>;
 
 auto assert_equivalence = [](M&& x, std::initializer_list <int>&& y)
 {
 for (decltype(M::size()) i{}; i != M::size(); ++i)
 assert (x[i] == std::cbegin (y)[i]);
 };
 
 V a{2}, b, c{3};
 b[0] = 1, b[1] = 2, b[2] = 3, b[3] = 4;
 
 // a == {2, 2, 2, 2}
 // b == {1, 2, 3, 4}
 // c == {3, 3, 3, 3}
 
 assert_equivalence(a == a, {1, 1, 1, 1});
 assert_equivalence(a == b, {0, 1, 0, 0});
 assert_equivalence(b == c, {0, 0, 1, 0});
 assert_equivalence(a == c, {0, 0, 0, 0});
 
 assert_equivalence(a != a, {0, 0, 0, 0});
 assert_equivalence(a != b, {1, 0, 1, 1});
 assert_equivalence(b != c, {1, 1, 0, 1});
 assert_equivalence(a != c, {1, 1, 1, 1});
 
 assert_equivalence(a < a, {0, 0, 0, 0});
 assert_equivalence(a < b, {0, 0, 1, 1});
 assert_equivalence(b < c, {1, 1, 0, 0});
 assert_equivalence(a < c, {1, 1, 1, 1});
}

[edit] See also

(parallelism TS v2)
reductions of simd_mask to bool
(function template) [edit]
(parallelism TS v2)
reduction of simd_mask to the number of true values
(function template) [edit]
(parallelism TS v2)
reductions of simd_mask to the index of the first or last true value
(function template) [edit]
(parallelism TS v2)
data-parallel type with the element type bool
(class template) [edit]
Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/experimental/simd/simd/operator_cmp&oldid=158187"

AltStyle によって変換されたページ (->オリジナル) /