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
46
47
48
49
50
51
52
//! # Leopard
//!
//! A high-performance parallelized vector container library with deferred execution.
//!
//! Leopard provides [`LVec`], a parallel vector container that records operations and
//! executes them in a single bulk parallel pass. This design minimizes thread pool
//! creation overhead by batching all operations together.
//!
//! ## Key Features
//!
//! - **Deferred Execution**: Operations are recorded between [`LQueue::start`] and
//! [`LQueue::end`], then executed in one parallel batch
//! - **Type-Agnostic Queue**: A single [`LQueue`] can manage `LVec<T>` of different types
//! - **SIMD-Style Masking**: Boolean masks with blend, select, and masked operations
//! - **Operator Overloading**: Natural syntax with `+`, `-`, `*`, `/` operators
//! - **Dependency Graph**: Operations are automatically ordered based on data dependencies
//!
//! ## Quick Start
//!
//! ```rust
//! use leopard::{LQueue, LVec, LMask};
//!
//! let q = LQueue::new();
//! let x: LVec<f64> = q.lvec_with_capacity(1000);
//! let y: LVec<f64> = q.lvec_with_capacity(1000);
//!
//! q.start();
//! let x = x.fill_with(|i| i as f64);
//! let y = y.fill_with(|i| (i * 2) as f64);
//! let z = &x * &y + &x;
//! q.end();
//!
//! let result = z.materialize().unwrap();
//! ```
//!
//! ## How It Works
//!
//! 1. **Recording Phase**: Between `q.start()` and `q.end()`, operations create
//! "pending" `LVec` instances and push operation descriptors to the queue.
//!
//! 2. **Dependency Analysis**: The queue builds a dependency graph to determine
//! execution order.
//!
//! 3. **Parallel Execution**: At `q.end()`, operations are executed level-by-level.
//! Each operation uses Rayon's parallel iterators for element-wise computation.
//!
//! 4. **Result Retrieval**: `materialize()` returns the computed `Arc<Vec<T>>`
//! for any pending `LVec`.
pub use ;