|
Stratax 0.4.0rc1
|
Integral bitwise operations and validated shift counts. More...
#include <stratax/core/dtypes/Concepts.hpp>#include <stratax/core/validation/NumericValidation.hpp>#include <stratax/ops/Broadcasting.hpp>#include <stratax/ops/detail/Compound.hpp>#include <functional>#include <type_traits>

Go to the source code of this file.
Functions | |
| template<Array A, Integral Count, typename Op > requires Integral<typename A::value_type> | |
| auto | stratax::core::bitwise_detail::shift_scalar_op (const A &lhs, const Count &rhs, Op op) |
| Applies a validated scalar shift to every array element. | |
| template<Array L, Array R, typename Op > requires ( Integral<typename L::value_type> && Integral<typename R::value_type> ) | |
| auto | stratax::core::bitwise_detail::shift_array_op (const L &lhs, const R &rhs, Op op) |
| Applies broadcasted per-element shift counts to an array. | |
| template<Integral Scalar, Array A, typename Op > requires Integral<typename A::value_type> | |
| auto | stratax::core::bitwise_detail::scalar_shift_array_op (const Scalar &lhs, const A &rhs, Op op) |
| Shifts a scalar by every count stored in an array. | |
| template<Array L, Array R, typename Op > requires ( Integral<typename L::value_type> && Integral<typename R::value_type> ) | |
| L & | stratax::core::bitwise_detail::compound_bitwise_op (L &lhs, const R &rhs, Op op) |
Applies a broadcasted bitwise operation to lhs in place. | |
| template<Array A, Integral Scalar, typename Op > requires Integral<typename A::value_type> | |
| A & | stratax::core::bitwise_detail::compound_scalar_bitwise_op (A &lhs, const Scalar &rhs, Op op) |
Applies a scalar bitwise operation to lhs in place. | |
| template<Array L, Array R, typename Op > requires ( Integral<typename L::value_type> && Integral<typename R::value_type> ) | |
| L & | stratax::core::bitwise_detail::compound_shift_op (L &lhs, const R &rhs, Op op) |
Applies validated broadcasted shift counts to lhs in place. | |
| template<Array L, Array R, typename Op > requires ( Integral<typename L::value_type> && Integral<typename R::value_type> ) | |
| auto | stratax::core::bitwise_detail::binary_bitwise_op (const L &lhs, const R &rhs, Op op) |
| Applies a bitwise callable to two broadcast-compatible integer arrays. | |
| template<Array A, Integral Scalar, typename Op > | |
| auto | stratax::core::bitwise_detail::binary_scalar_bitwise_op (const A &arr, const Scalar &scalar, Op op) |
| Applies a callable to every integer array element and a right scalar. | |
| template<Integral Scalar, Array A, typename Op > | |
| auto | stratax::core::bitwise_detail::binary_scalar_bitwise_op (const Scalar &scalar, const A &arr, Op op) |
| Applies a callable to a left scalar and every integer array element. | |
| template<Array A, Integral Count, typename Op > requires Integral<typename A::value_type> | |
| A & | stratax::core::bitwise_detail::compound_scalar_shift_op (A &lhs, const Count &rhs, Op op) |
| Applies a validated scalar shift to an array in place. | |
| template<Array A> requires Integral<typename A::value_type> | |
| A | operator~ (const A &value) |
| Applies bitwise NOT to each element of an integer array. | |
| template<Array L, Array R> requires ( Integral<typename L::value_type> && Integral<typename R::value_type> ) | |
| auto | operator& (const L &lhs, const R &rhs) |
| Computes the broadcasted element-wise bitwise AND. | |
| template<Array L, Array R> requires ( Integral<typename L::value_type> && Integral<typename R::value_type> ) | |
| auto | operator| (const L &lhs, const R &rhs) |
| Computes the broadcasted element-wise bitwise OR. | |
| template<Array L, Array R> requires ( Integral<typename L::value_type> && Integral<typename R::value_type> ) | |
| auto | operator^ (const L &lhs, const R &rhs) |
| Computes the broadcasted element-wise bitwise XOR. | |
| template<Array L, Array R> requires ( Integral<typename L::value_type> && Integral<typename R::value_type> ) | |
| auto | operator<< (const L &lhs, const R &rhs) |
| Left-shifts broadcasted left values by corresponding right counts. | |
| template<Array L, Array R> requires ( Integral<typename L::value_type> && Integral<typename R::value_type> ) | |
| auto | operator>> (const L &lhs, const R &rhs) |
| Right-shifts broadcasted left values by corresponding right counts. | |
| template<Array A, Integral Scalar> requires Integral<typename A::value_type> | |
| auto | operator& (const A &lhs, const Scalar &rhs) |
| Applies bitwise AND between each array element and a scalar. | |
| template<Array A, Integral Scalar> requires Integral<typename A::value_type> | |
| auto | operator| (const A &lhs, const Scalar &rhs) |
| Applies bitwise OR between each array element and a scalar. | |
| template<Array A, Integral Scalar> requires Integral<typename A::value_type> | |
| auto | operator^ (const A &lhs, const Scalar &rhs) |
| Applies bitwise XOR between each array element and a scalar. | |
| template<Array A, Integral Scalar> requires Integral<typename A::value_type> | |
| auto | operator<< (const A &lhs, const Scalar &rhs) |
| Left-shifts every array element by a validated scalar count. | |
| template<Array A, Integral Scalar> requires Integral<typename A::value_type> | |
| auto | operator>> (const A &lhs, const Scalar &rhs) |
| Right-shifts every array element by a validated scalar count. | |
| template<Integral Scalar, Array A> requires Integral<typename A::value_type> | |
| auto | operator& (const Scalar &lhs, const A &rhs) |
| Applies bitwise AND between a scalar and each array element. | |
| template<Integral Scalar, Array A> requires Integral<typename A::value_type> | |
| auto | operator| (const Scalar &lhs, const A &rhs) |
| Applies bitwise OR between a scalar and each array element. | |
| template<Integral Scalar, Array A> requires Integral<typename A::value_type> | |
| auto | operator^ (const Scalar &lhs, const A &rhs) |
| Applies bitwise XOR between a scalar and each array element. | |
| template<Integral Scalar, Array A> requires Integral<typename A::value_type> | |
| auto | operator<< (const Scalar &lhs, const A &rhs) |
| Left-shifts a scalar by every validated count in an array. | |
| template<Integral Scalar, Array A> requires Integral<typename A::value_type> | |
| auto | operator>> (const Scalar &lhs, const A &rhs) |
| Right-shifts a scalar by every validated count in an array. | |
| template<Array L, Array R> requires ( Integral<typename L::value_type> && Integral<typename R::value_type> ) | |
| L & | operator&= (L &lhs, const R &rhs) |
| Applies broadcasted bitwise AND assignment. | |
| template<Array L, Array R> requires ( Integral<typename L::value_type> && Integral<typename R::value_type> ) | |
| L & | operator|= (L &lhs, const R &rhs) |
| Applies broadcasted bitwise OR assignment. | |
| template<Array L, Array R> requires ( Integral<typename L::value_type> && Integral<typename R::value_type> ) | |
| L & | operator^= (L &lhs, const R &rhs) |
| Applies broadcasted bitwise XOR assignment. | |
| template<Array L, Array R> requires ( Integral<typename L::value_type> && Integral<typename R::value_type> ) | |
| L & | operator<<= (L &lhs, const R &rhs) |
| Applies broadcasted left-shift assignment after validating every count. | |
| template<Array L, Array R> requires ( Integral<typename L::value_type> && Integral<typename R::value_type> ) | |
| L & | operator>>= (L &lhs, const R &rhs) |
| Applies broadcasted right-shift assignment after validating every count. | |
| template<Array A, Integral Scalar> requires Integral<typename A::value_type> | |
| A & | operator&= (A &lhs, const Scalar &rhs) |
| Applies bitwise AND assignment with a scalar to every element. | |
| template<Array A, Integral Scalar> requires Integral<typename A::value_type> | |
| A & | operator|= (A &lhs, const Scalar &rhs) |
| Applies bitwise OR assignment with a scalar to every element. | |
| template<Array A, Integral Scalar> requires Integral<typename A::value_type> | |
| A & | operator^= (A &lhs, const Scalar &rhs) |
| Applies bitwise XOR assignment with a scalar to every element. | |
| template<Array A, Integral Scalar> requires Integral<typename A::value_type> | |
| A & | operator<<= (A &lhs, const Scalar &rhs) |
| Applies left-shift assignment with a scalar to every element. | |
| template<Array A, Integral Scalar> requires Integral<typename A::value_type> | |
| A & | operator>>= (A &lhs, const Scalar &rhs) |
| Applies right-shift assignment with a scalar to every element. | |
Integral bitwise operations and validated shift counts.
Operations that allocate results require owning-container result trait specializations. Element operators receive the original operand types; the result is converted afterward. Native C++ arithmetic and conversion rules apply, including representability requirements. Compound operations use the operands' initial values, including aliased scalars and overlapping views. Repeated destination offsets receive the last logical write. Operations involving views stage O(n) results. Allocation failures propagate.
Definition in file Bitwise.hpp.
| auto stratax::core::bitwise_detail::binary_bitwise_op | ( | const L & | lhs, |
| const R & | rhs, | ||
| Op | op | ||
| ) |
Applies a bitwise callable to two broadcast-compatible integer arrays.
Matching container families are preserved and mixed families promote to Tensor. The result uses the promoted dtype of the operands.
| L | Left integral-valued Stratax array type. |
| R | Right integral-valued Stratax array type. |
| Op | Binary bitwise callable. |
| lhs | Left array operand. |
| rhs | Right array operand. |
| op | Callable invoked in flat iterator order. |
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
| Any | exception propagated by result allocation or op. |
n is result size and r is result rank. Definition at line 299 of file Bitwise.hpp.
| auto stratax::core::bitwise_detail::binary_scalar_bitwise_op | ( | const A & | arr, |
| const Scalar & | scalar, | ||
| Op | op | ||
| ) |
Applies a callable to every integer array element and a right scalar.
| A | Integral-valued owning Stratax array. |
| Scalar | Integral scalar type. |
| Op | Binary bitwise or shift callable. |
| arr | Array supplying every left argument. |
| scalar | Scalar supplied as every right argument. |
| op | Callable invoked in flat iterator order. |
arr. | Any | exception propagated by result allocation or op. |
Definition at line 329 of file Bitwise.hpp.
| auto stratax::core::bitwise_detail::binary_scalar_bitwise_op | ( | const Scalar & | scalar, |
| const A & | arr, | ||
| Op | op | ||
| ) |
Applies a callable to a left scalar and every integer array element.
| Scalar | Integral scalar type. |
| A | Integral-valued owning Stratax array. |
| Op | Binary bitwise or shift callable. |
| scalar | Scalar supplied as every left argument. |
| arr | Array supplying every right argument. |
| op | Callable invoked in flat iterator order. |
arr. | Any | exception propagated by result allocation or op. |
Definition at line 365 of file Bitwise.hpp.
| L & stratax::core::bitwise_detail::compound_bitwise_op | ( | L & | lhs, |
| const R & | rhs, | ||
| Op | op | ||
| ) |
Applies a broadcasted bitwise operation to lhs in place.
lhs, whose shape and dtype remain unchanged. | Exceptions::BroadcastError | If broadcasting is impossible or would change the shape of lhs. |
Definition at line 170 of file Bitwise.hpp.
| A & stratax::core::bitwise_detail::compound_scalar_bitwise_op | ( | A & | lhs, |
| const Scalar & | rhs, | ||
| Op | op | ||
| ) |
Applies a scalar bitwise operation to lhs in place.
lhs. Definition at line 205 of file Bitwise.hpp.
| A & stratax::core::bitwise_detail::compound_scalar_shift_op | ( | A & | lhs, |
| const Count & | rhs, | ||
| Op | op | ||
| ) |
Applies a validated scalar shift to an array in place.
lhs. Definition at line 397 of file Bitwise.hpp.
| L & stratax::core::bitwise_detail::compound_shift_op | ( | L & | lhs, |
| const R & | rhs, | ||
| Op | op | ||
| ) |
Applies validated broadcasted shift counts to lhs in place.
All used counts are validated before mutation, so an invalid count leaves lhs unchanged.
lhs, whose shape and dtype remain unchanged. | Exceptions::BroadcastError | If broadcasting is impossible or would change the shape of lhs. |
| Exceptions::ValueError | If any used shift count is invalid. |
Definition at line 239 of file Bitwise.hpp.
| auto operator& | ( | const A & | lhs, |
| const Scalar & | rhs | ||
| ) |
Applies bitwise AND between each array element and a scalar.
Definition at line 513 of file Bitwise.hpp.
| auto operator& | ( | const L & | lhs, |
| const R & | rhs | ||
| ) |
Computes the broadcasted element-wise bitwise AND.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
Definition at line 444 of file Bitwise.hpp.
| auto operator& | ( | const Scalar & | lhs, |
| const A & | rhs | ||
| ) |
Applies bitwise AND between a scalar and each array element.
Definition at line 570 of file Bitwise.hpp.
| A & operator&= | ( | A & | lhs, |
| const Scalar & | rhs | ||
| ) |
Applies bitwise AND assignment with a scalar to every element.
lhs; shape and dtype are preserved. Definition at line 697 of file Bitwise.hpp.
| L & operator&= | ( | L & | lhs, |
| const R & | rhs | ||
| ) |
Applies broadcasted bitwise AND assignment.
lhs. | Exceptions::BroadcastError | If broadcasting is impossible or would change the left shape. |
Definition at line 630 of file Bitwise.hpp.
| auto operator<< | ( | const A & | lhs, |
| const Scalar & | rhs | ||
| ) |
Left-shifts every array element by a validated scalar count.
Definition at line 540 of file Bitwise.hpp.
| auto operator<< | ( | const L & | lhs, |
| const R & | rhs | ||
| ) |
Left-shifts broadcasted left values by corresponding right counts.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
| Exceptions::ValueError | If a used count is invalid. |
Definition at line 480 of file Bitwise.hpp.
| auto operator<< | ( | const Scalar & | lhs, |
| const A & | rhs | ||
| ) |
Left-shifts a scalar by every validated count in an array.
| Exceptions::ValueError | If any count is invalid. |
Definition at line 597 of file Bitwise.hpp.
| A & operator<<= | ( | A & | lhs, |
| const Scalar & | rhs | ||
| ) |
Applies left-shift assignment with a scalar to every element.
lhs; shape and dtype are preserved. | Exceptions::ValueError | If the count is invalid, including for an empty array; validation precedes writes. |
Definition at line 724 of file Bitwise.hpp.
| L & operator<<= | ( | L & | lhs, |
| const R & | rhs | ||
| ) |
Applies broadcasted left-shift assignment after validating every count.
lhs. | Exceptions::BroadcastError | If broadcasting is impossible or would change the left shape. |
| Exceptions::ValueError | If a used count is invalid. |
Definition at line 666 of file Bitwise.hpp.
| auto operator>> | ( | const A & | lhs, |
| const Scalar & | rhs | ||
| ) |
Right-shifts every array element by a validated scalar count.
Definition at line 554 of file Bitwise.hpp.
| auto operator>> | ( | const L & | lhs, |
| const R & | rhs | ||
| ) |
Right-shifts broadcasted left values by corresponding right counts.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
| Exceptions::ValueError | If a used count is invalid. |
Definition at line 497 of file Bitwise.hpp.
| auto operator>> | ( | const Scalar & | lhs, |
| const A & | rhs | ||
| ) |
Right-shifts a scalar by every validated count in an array.
| Exceptions::ValueError | If any count is invalid. |
Definition at line 611 of file Bitwise.hpp.
| A & operator>>= | ( | A & | lhs, |
| const Scalar & | rhs | ||
| ) |
Applies right-shift assignment with a scalar to every element.
lhs; shape and dtype are preserved. | Exceptions::ValueError | If the count is invalid, including for an empty array; validation precedes writes. |
Definition at line 738 of file Bitwise.hpp.
| L & operator>>= | ( | L & | lhs, |
| const R & | rhs | ||
| ) |
Applies broadcasted right-shift assignment after validating every count.
lhs. | Exceptions::BroadcastError | If broadcasting is impossible or would change the left shape. |
| Exceptions::ValueError | If a used count is invalid. |
Definition at line 682 of file Bitwise.hpp.
| auto operator^ | ( | const A & | lhs, |
| const Scalar & | rhs | ||
| ) |
Applies bitwise XOR between each array element and a scalar.
Definition at line 531 of file Bitwise.hpp.
| auto operator^ | ( | const L & | lhs, |
| const R & | rhs | ||
| ) |
Computes the broadcasted element-wise bitwise XOR.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
Definition at line 468 of file Bitwise.hpp.
| auto operator^ | ( | const Scalar & | lhs, |
| const A & | rhs | ||
| ) |
Applies bitwise XOR between a scalar and each array element.
Definition at line 588 of file Bitwise.hpp.
| A & operator^= | ( | A & | lhs, |
| const Scalar & | rhs | ||
| ) |
Applies bitwise XOR assignment with a scalar to every element.
lhs; shape and dtype are preserved. Definition at line 715 of file Bitwise.hpp.
| L & operator^= | ( | L & | lhs, |
| const R & | rhs | ||
| ) |
Applies broadcasted bitwise XOR assignment.
lhs. | Exceptions::BroadcastError | If broadcasting is impossible or would change the left shape. |
Definition at line 654 of file Bitwise.hpp.
| auto operator| | ( | const A & | lhs, |
| const Scalar & | rhs | ||
| ) |
Applies bitwise OR between each array element and a scalar.
Definition at line 522 of file Bitwise.hpp.
| auto operator| | ( | const L & | lhs, |
| const R & | rhs | ||
| ) |
Computes the broadcasted element-wise bitwise OR.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
Definition at line 456 of file Bitwise.hpp.
| auto operator| | ( | const Scalar & | lhs, |
| const A & | rhs | ||
| ) |
Applies bitwise OR between a scalar and each array element.
Definition at line 579 of file Bitwise.hpp.
| A & operator|= | ( | A & | lhs, |
| const Scalar & | rhs | ||
| ) |
Applies bitwise OR assignment with a scalar to every element.
lhs; shape and dtype are preserved. Definition at line 706 of file Bitwise.hpp.
| L & operator|= | ( | L & | lhs, |
| const R & | rhs | ||
| ) |
Applies broadcasted bitwise OR assignment.
lhs. | Exceptions::BroadcastError | If broadcasting is impossible or would change the left shape. |
Definition at line 642 of file Bitwise.hpp.
Applies bitwise NOT to each element of an integer array.
| value | Source array. |
~value[i]. Definition at line 423 of file Bitwise.hpp.
| auto stratax::core::bitwise_detail::scalar_shift_array_op | ( | const Scalar & | lhs, |
| const A & | rhs, | ||
| Op | op | ||
| ) |
Shifts a scalar by every count stored in an array.
rhs's container and shape and the scalar dtype. | Exceptions::ValueError | If any shift count is invalid. |
Definition at line 127 of file Bitwise.hpp.
| auto stratax::core::bitwise_detail::shift_array_op | ( | const L & | lhs, |
| const R & | rhs, | ||
| Op | op | ||
| ) |
Applies broadcasted per-element shift counts to an array.
| Exceptions::BroadcastError | If shapes are incompatible or an empty operand would supply values to a nonempty result. |
| Exceptions::ValueError | If any used shift count is invalid. |
n is result size and r is result rank. Definition at line 74 of file Bitwise.hpp.
| auto stratax::core::bitwise_detail::shift_scalar_op | ( | const A & | lhs, |
| const Count & | rhs, | ||
| Op | op | ||
| ) |
Applies a validated scalar shift to every array element.
lhs. | Exceptions::ValueError | If rhs is not a valid shift count. |
Definition at line 34 of file Bitwise.hpp.