Miscellaneous
Sign manipulation:
|
per slot sign extraction |
|
per slot sign extraction on non null elements |
|
per slot sign bit extraction |
|
per slot sign copy |
Stream operation:
|
batch pretty-printing |
- template<class T, class A> XSIMD_INLINE batch< T, A > bitofsign (batch< T, A > const &x) noexcept
Computes the bit of sign of
x
.- Parameters:
x – batch of scalar
- Returns:
bit of sign of
x
- template<class T, class A> XSIMD_INLINE batch< T, A > copysign (batch< T, A > const &x, batch< T, A > const &y) noexcept
Computes a value whose absolute value matches that of
x
, but whose sign bit matches that ofy
.- Parameters:
x – batch of scalars
y – batch of scalars
- Returns:
batch whose absolute value matches that of
x
, but whose sign bit matches that ofy
.
- template<class T, class A> XSIMD_INLINE batch< T, A > select (batch_bool< T, A > const &cond, batch< T, A > const &true_br, batch< T, A > const &false_br) noexcept
Ternary operator for batches: selects values from the batches
true_br
orfalse_br
depending on the boolean values in the constant batchcond
.Equivalent to
for(std::size_t i = 0; i < N; ++i) res[i] = cond[i] ? true_br[i] : false_br[i];
- Parameters:
cond – batch condition.
true_br – batch values for truthy condition.
false_br – batch value for falsy condition.
- Returns:
the result of the selection.
- template<class T, class A> XSIMD_INLINE batch< std::complex< T >, A > select (batch_bool< T, A > const &cond, batch< std::complex< T >, A > const &true_br, batch< std::complex< T >, A > const &false_br) noexcept
Ternary operator for batches: selects values from the batches
true_br
orfalse_br
depending on the boolean values in the constant batchcond
.Equivalent to
for(std::size_t i = 0; i < N; ++i) res[i] = cond[i] ? true_br[i] : false_br[i];
- Parameters:
cond – batch condition.
true_br – batch values for truthy condition.
false_br – batch value for falsy condition.
- Returns:
the result of the selection.
- template<class T, class A, bool... Values> XSIMD_INLINE batch< T, A > select (batch_bool_constant< T, A, Values... > const &cond, batch< T, A > const &true_br, batch< T, A > const &false_br) noexcept
Ternary operator for batches: selects values from the batches
true_br
orfalse_br
depending on the boolean values in the constant batchcond
.Equivalent to
for(std::size_t i = 0; i < N; ++i) res[i] = cond[i] ? true_br[i] : false_br[i];
- Parameters:
cond – constant batch condition.
true_br – batch values for truthy condition.
false_br – batch value for falsy condition.
- Returns:
the result of the selection.
- template<class T, class A> XSIMD_INLINE batch< T, A > sign (batch< T, A > const &x) noexcept
Computes the sign of
x
.- Parameters:
x – batch
- Returns:
-1 for each negative element, -1 or +1 for each null element and +1 for each element
- template<class T, class A> XSIMD_INLINE batch< T, A > signnz (batch< T, A > const &x) noexcept
Computes the sign of
x
, assuming x doesn’t have any zero.- Parameters:
x – batch
- Returns:
-1 for each negative element, -1 or +1 for each null element and +1 for each element
- template<class T, class A> XSIMD_INLINE std::ostream & operator<< (std::ostream &o, batch< T, A > const &x) noexcept
Dump the content of batch
x
to streamo
.- Parameters:
o – the stream where the batch is dumped
x – batch to dump.
- Returns:
a reference to
o
- template<class T, class A> XSIMD_INLINE std::ostream & operator<< (std::ostream &o, batch_bool< T, A > const &x) noexcept
Dump the content of batch
x
to streamo
.- Parameters:
o – the stream where the batch is dumped
x – batch to dump.
- Returns:
a reference to
o