pub struct StreamingBorderGram { /* private fields */ }Expand description
Chunked, out-of-core, bit-reproducible border-Gram accumulator.
Accumulates G = Σ_n x_n x_nᵀ ∈ ℝ^{k×k} over n_rows rows submitted as
fixed-size chunks (any submission order), with f64 accumulation throughout
and a deterministic pairwise reduction tree whose shape is a pure function
of (n_rows, chunk_size). See the module docs for the determinism
contract.
Implementations§
Source§impl StreamingBorderGram
impl StreamingBorderGram
Sourcepub fn new(
border_dim: usize,
n_rows: usize,
chunk_size: usize,
) -> Result<Self, String>
pub fn new( border_dim: usize, n_rows: usize, chunk_size: usize, ) -> Result<Self, String>
Create an empty accumulator for n_rows total rows of border dimension
border_dim, streamed in chunks of chunk_size rows.
Sourcepub fn chunk_rows(&self, chunk_index: usize) -> Range<usize> ⓘ
pub fn chunk_rows(&self, chunk_index: usize) -> Range<usize> ⓘ
Row range covered by chunk chunk_index:
[chunk_index·chunk_size, min((chunk_index+1)·chunk_size, n_rows)).
A pure function of the partition parameters — the caller slices its
shard rows with exactly this range.
Sourcepub fn frontier(&self) -> usize
pub fn frontier(&self) -> usize
Number of chunks already consumed by the in-order cascade (the chunk cursor). Pending out-of-order chunks are not counted.
Sourcepub fn checkpoint(&self) -> BorderGramCheckpoint
pub fn checkpoint(&self) -> BorderGramCheckpoint
Serialize the full accumulation state — partial Grams + chunk cursor —
for checkpointing. StreamingBorderGram::resume reconstructs an
accumulator whose future behavior is bit-identical to never having
stopped.
Sourcepub fn resume(state: BorderGramCheckpoint) -> Result<Self, String>
pub fn resume(state: BorderGramCheckpoint) -> Result<Self, String>
Reconstruct an accumulator from a checkpoint. Validates the structural invariants so a corrupted checkpoint is rejected loudly instead of silently producing a wrong (but plausible-looking) Gram.
Sourcepub fn finish(self) -> Result<Array2<f64>, String>
pub fn finish(self) -> Result<Array2<f64>, String>
Finish the pass, returning the k×k border Gram. Errors if any chunk
is missing (out-of-order pending chunks the frontier never reached, or
chunks never submitted). The result is a pure function of the row
content: identical bits for any submission order and for any
checkpoint/resume history.
Auto Trait Implementations§
impl Freeze for StreamingBorderGram
impl RefUnwindSafe for StreamingBorderGram
impl Send for StreamingBorderGram
impl Sync for StreamingBorderGram
impl Unpin for StreamingBorderGram
impl UnsafeUnpin for StreamingBorderGram
impl UnwindSafe for StreamingBorderGram
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.