pub struct Sam { /* private fields */ }Expand description
Suffix automaton with CSR (sorted-per-state) transitions — built once, queried by scans.
For the range-restricted recursion (fix b), each state also carries its endpos as a
contiguous slice [dfs_in, dfs_in+dfs_cnt) of epos (the end-positions in b, laid out by
a DFS of the suffix-link tree so a subtree is contiguous). A merge-sort tree over epos
answers “is there an end-position in [lo,hi] within this state’s subtree, and the min/max
such” — so the whole RO recursion runs on this one prebuilt SAM, with no sub-builds.
Implementations§
Source§impl Sam
impl Sam
Sourcepub fn nodes(&self) -> &[[u32; 4]]
pub fn nodes(&self) -> &[[u32; 4]]
Read-only view of the packed [len, link, edge_lo, edge_hi] per state — needed by the
GPU port (gpu::matching_stats_gpu) to serialize the SAM into a Metal buffer. The kernel
reads this slice via index calculations, so we expose it raw (one [u32; 4] per state).
Sourcepub fn edges_packed(&self) -> &[u64]
pub fn edges_packed(&self) -> &[u64]
Read-only view of the packed edge slice: (char << 32) | target_state, sorted by char
within each state’s [edge_lo, edge_hi) range. The GPU kernel does binary search over
this slice exactly as csr_lookup does on the CPU.
Sourcepub fn root_next_table(&self) -> &[i32]
pub fn root_next_table(&self) -> &[i32]
Read-only view of the root’s direct ASCII transition table (root_next[c] = state, or
-1 for missing). 128 entries per SAM. The GPU kernel uses this to skip the binary
search at the root state, exactly as the CPU does.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sam
impl RefUnwindSafe for Sam
impl Send for Sam
impl Sync for Sam
impl Unpin for Sam
impl UnsafeUnpin for Sam
impl UnwindSafe for Sam
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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