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>
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>
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>
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>
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>
inline batch<T, A> select(batch_bool_constant<batch<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>
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>
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