Batch¶
|
Class batch |
|
Class batch_const |
Classes¶
-
template<typename
T
, std::size_tN
>
classbatch
¶ XSIMD-like class representing a batch of values.
This class simulates the functionality of the class with the same name present within the XSIMD library. It represents a batch of integer or floating point values.
One key difference between this class and its XSIMD counterpart is that this implementation does not derive from xsimd::simd_base, which allows some hackery to make it compatible even if XSIMD is used alongside it.
- Note
This class does not replicate all the functionalities of the batch class in the XSIMD library
- Template Parameters
T
: Underlying arithmetic typeN
: Number of values within a batch
Public Functions
-
batch
()¶ Default constructor.
-
batch
(T data[N])¶ Constructor from an array of values.
Initializes a batch to the values pointed by
data
.
-
batch
(const std::array<T, N> &data)¶ Constructor from an array of values.
Initializes a batch to the values pointed by
data
.
-
batch
(T val)¶ Constructor from scalar values.
Initializes all the values of the batch to
val
.
-
auto
operator[]
(std::size_t idx) const¶ Access element (const)
- Return
The element at the specified position
- Parameters
idx
: Index of an element in the batch
-
auto &
operator[]
(std::size_t idx)¶ Access element.
- Return
A reference to the element at the specified position
- Parameters
idx
: Index of an element in the batch
-
auto &
operator=
(const batch<const T, N> &rhs)¶ Assignment operator.
Assignment operator for batches of constant values.
- Return
A reference to
this
.- Parameters
rhs
: Batch of constant values
-
auto &
operator=
(batch<const T, N> &&rhs)¶ Move assignment operator.
Move assignment operator for batches of constant values.
- Return
A reference to
this
.- Parameters
rhs
: R-value of batch of constant values
-
template<typename
U
, typename = std::enable_if_t<details::is_valid_expr<U>::value, U>>
auto &operator=
(U &&expr)¶ Assignment operator for arbitrary expressions.
- Return
A reference to
this
.- Parameters
rhs
: RHS expression
-
auto &
operator++
()¶ Pre-increment operator.
- Return
A reference to
this
.
-
auto
operator++
(int)¶ Post-increment operator.
- Return
A reference to
this
.
-
auto &
operator--
()¶ Pre-decrement operator.
- Return
A reference to
this
.
-
auto
operator--
(int)¶ Post-decrement operator.
- Return
A reference to
this
.
-
auto
begin
()¶ Returns iterator to beginning.
-
auto
end
()¶ Returns iterator to end.
-
auto
begin
() const¶ Returns const_iterator to beginning.
-
auto
end
() const¶ Returns const_iterator to end.
-
auto
cbegin
() const¶ Returns const_iterator to beginning.
-
auto
cend
() const¶ Returns const_iterator to end.
-
auto
rbegin
()¶ Return reverse_iterator to reverse beginning.
-
auto
rend
()¶ Return reverse_iterator to reverse end.
-
auto
rbegin
() const¶ Return const_reverse_iterator to reverse beginning.
-
auto
rend
() const¶ Return const_reverse_iterator to reverse end.
-
auto
crbegin
() const¶ Return const_reverse_iterator to reverse beginning.
-
auto
crend
() const¶ Return const_reverse_iterator to reverse end.
-
template<typename
T
, std::size_tN
>
classbatch
<const T, N>¶ Specialisation for batches of constant values.
This specialisation is a deviation to the API provided by XSIMD. Its main objective is to allow our fallback library to refer to eternal memory without actually copying the data into the batch itself. This is an extra optimisation for users that do not have XSIMD installed and will not have any effect on valid XSIMD code that is ported to our library.
- Warning
A default initilized batch of constant value has an invalid pointer and should not be used as-is.
Public Functions
-
constexpr auto
operator[]
(std::size_t idx) const Access element (const)
- Return
The element at the specified position
- Parameters
idx
: Index of an element in the batch
-
constexpr auto
begin
() const Returns const_iterator to beginning.
-
constexpr auto
end
() const Returns const_iterator to end.
-
constexpr auto
cbegin
() const Returns const_iterator to beginning.
-
constexpr auto
cend
() const Returns const_iterator to end.
-
constexpr auto
rbegin
() const Return const_reverse_iterator to reverse beginning.
-
constexpr auto
rend
() const Return const_reverse_iterator to reverse end.
-
constexpr auto
crbegin
() const Return const_reverse_iterator to reverse beginning.
-
constexpr auto
crend
() const Return const_reverse_iterator to reverse end.