pub struct IndirectionTable { /* private fields */ }Expand description
A two-tier indirection table for deterministic O(1) lookup.
Architecture:
- Level 0 (Coarse Array): A flat, uniform array spanning the entire domain at low resolution.
- Level 1 (High-Resolution Array): Packed blocks of fine-grained data for refined regions.
Each entry in Level 0 contains either:
- A Direct Value: The actual lookup result (if no refinement needed)
- A Pointer: An offset into Level 1 pointing to the start of a high-res block
A bit-flag (sign bit) distinguishes the two cases.
Implementations§
Source§impl IndirectionTable
impl IndirectionTable
Sourcepub fn new(
coarse: Vec<(f64, bool)>,
fine: Vec<f64>,
min: f64,
max: f64,
coarse_resolution: usize,
) -> Self
pub fn new( coarse: Vec<(f64, bool)>, fine: Vec<f64>, min: f64, max: f64, coarse_resolution: usize, ) -> Self
Create an indirection table from coarse and fine-grained data.
§Arguments
coarse- Level 0 entries: (value_or_offset, is_pointer) tuplesfine- Level 1: packed high-resolution blocksmin- Domain minimummax- Domain maximumcoarse_resolution- Number of cells in coarse grid
Sourcepub fn lookup(&self, x: f64) -> f64
pub fn lookup(&self, x: f64) -> f64
Branchless $O(1)$ lookup at a single point.
Returns either the direct value (single fetch) or looks up in Level 1 (dual fetch).
Sourcepub fn stats(&self) -> IndirectionStats
pub fn stats(&self) -> IndirectionStats
Get statistics about the table structure.
Trait Implementations§
Source§impl Clone for IndirectionTable
impl Clone for IndirectionTable
Source§fn clone(&self) -> IndirectionTable
fn clone(&self) -> IndirectionTable
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for IndirectionTable
impl Debug for IndirectionTable
Source§impl<'de> Deserialize<'de> for IndirectionTable
impl<'de> Deserialize<'de> for IndirectionTable
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for IndirectionTable
impl RefUnwindSafe for IndirectionTable
impl Send for IndirectionTable
impl Sync for IndirectionTable
impl Unpin for IndirectionTable
impl UnsafeUnpin for IndirectionTable
impl UnwindSafe for IndirectionTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more