1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Zero-cost operation strategy markers for SIMD reductions and elementwise transforms.
//!
//! `ReductionOp<T>`, `ElementOp<T>`, and `UnaryOp<T>` are sealed ZST traits parameterized
//! by the scalar type `T: Scalar`. Concrete strategies (`Sum`, `Dot`, `Mul`, `Add`, `Sub`,
//! `Abs`, `Neg`, `Sqrt`) implement these traits and are passed as ZST values — they carry no
//! runtime data and the compiler eliminates all abstraction overhead via monomorphization.
//!
//! # Module Organization
//!
//! | Sub-module | Contents |
//! |---|---|
//! | [`reduction`] | `ReductionOp<T>`, `Sum`, `Dot`, `Min`, `Max`, `Product` |
//! | [`elementwise`] | `ElementOp<T>`, `Mul`, `Add`, `Sub`, `Div`, `BitAnd`, `BitOr`, `BitXor`, `FmaAdd`, `Clamp` |
//! | [`unary`] | `UnaryOp<T>`, `Abs`, `Neg`, `Sqrt` (and `Clamp` as `UnaryOp`) |
//! | [`scan`] | `ScanOp<T>`, `ScanMode`, `ScanAdd`, `ScanMul`, `ScanMin`, `ScanMax`, `Inclusive`, `Exclusive` |
//!
//! # Usage
//!
//! ```rust,ignore
//! let total: f32 = view.reduce(ops::Sum);
//! let dot: f32 = view.zip_reduce(&other, ops::Dot)?;
//! ```
//!
//! # Zero-Cost Guarantee
//!
//! Each `unsafe fn accumulate` / `unsafe fn apply` call site is a direct call to
//! an `#[inline(always)]` function that the compiler inlines into the surrounding loop.
//! The ZST parameter is erased entirely — `size_of::<Sum>() == 0`.
//!
//! # Scalar Tail Handling
//!
//! `ElementOp<T>` provides `apply_scalar(a, b) -> T` for processing tail elements that
//! do not fill a complete SIMD vector. This is a pure scalar operation using `T: Scalar`
//! arithmetic operators, eliminating all boundary-condition UB from vector load/store.
// Re-exports for backwards-compatible access at the `ops::*` level.
pub use ;
pub use ;
pub use ;
pub use ;