Skip to main content

rlevo_evolution/algorithms/metaheuristic/kernels/
mod.rs

1//! Custom `CubeCL` kernels for swarm-algorithm hot paths.
2//!
3//! Two kernels live here, both gated behind the crate-level
4//! `custom-kernels` feature:
5//!
6//! - [`pairwise_attract_cube`] — fuses Firefly's `O(N²D)` attractiveness
7//!   update into a single launch that streams over neighbours to keep
8//!   memory `O(ND)`.
9//! - [`levy_flight_cube`] — fuses Mantegna's three-op Lévy-stable
10//!   sampler into one launch. Wired into [`super::cuckoo`] and optionally
11//!   [`super::bat`] only when profiling shows it on a hot path.
12//!
13//! When `custom-kernels` is off, the [`super::firefly`] module caps
14//! population at `N ≤ 128` and emits the pure-tensor `O(N²D)`
15//! decomposition; [`super::cuckoo`] and [`super::bat`] fall back to
16//! pure-tensor Mantegna sampling built from `Tensor::random_normal` +
17//! element-wise ops.
18
19#[cfg(feature = "custom-kernels")]
20pub mod levy_flight_cube;
21#[cfg(feature = "custom-kernels")]
22pub mod pairwise_attract_cube;