lazymatrix::LazyRow
LazyMatrix for Rust · 0.8.1
pub struct LazyRow<'a, F>A borrowed sparse row with lazy column normalization.
The raw column indices and values, and the optional centers and scales, are borrowed without copying. Each logical entry is (raw[j] - center[j]) / scale[j], with effective centers of zero and scales of one when inactive. If storage contains duplicate column indices, sum their raw values before applying normalization.
The sparse-plus-affine representation consists of a generally dense background -center[j] / scale[j] and stored corrections value / scale[j]. A centered logical row can therefore be dense even when its raw row is empty. Self::implicit_value and Self::stored_corrections expose these parts without allocating a dense row. Adding the parts can differ from direct normalization because of floating-point rounding or nonfinite arithmetic.
Inherent implementation
impl<'a, F> LazyRow<'a, F>centers
pub fn centers(&self) -> Option<&'a [F]>Borrow the full column-center slice, or None when centering is inactive.
column_indices
pub fn column_indices(&self) -> &'a [usize]Column indices of the raw stored entries, in backend storage order.
Unsorted and duplicate indices remain present.
is_empty
pub fn is_empty(&self) -> boolWhether the logical row has no columns.
A row with no stored entries can still have a nonzero logical length.
len
pub fn len(&self) -> usizeLogical length of the row, including structurally absent entries.
scales
pub fn scales(&self) -> Option<&'a [F]>Borrow the full column-scale slice, or None when scaling is inactive.
values
pub fn values(&self) -> &'a [F]Raw stored values corresponding to Self::column_indices.
Explicitly stored zeros remain present.
Inherent implementation
impl<F: Scalar> LazyRow<'_, F>center
pub fn center(&self, j: usize) -> FEffective center of column j, or zero when centering is inactive.
This takes O(1) time.
Panics
Panics if j >= self.len().
implicit_value
pub fn implicit_value(&self, j: usize) -> FLogical value at a structurally absent column, -center(j) / scale(j).
This takes O(1) time.
Panics
Panics if j >= self.len().
scale
pub fn scale(&self, j: usize) -> FEffective scale of column j, or one when scaling is inactive.
This takes O(1) time.
Panics
Panics if j >= self.len().
stored_corrections
pub fn stored_corrections(&self) -> impl Iterator<Item = (usize, F)> + '_Stored corrections to the background as (column, raw_value / scale).
The iterator preserves storage order, duplicates, and explicit zeros. Consuming it takes O(stored entries) time and allocates nothing. These corrections exclude centering; see the type documentation for the relationship to direct logical normalization.
Implementation of Clone
impl<'a, F: core::clone::Clone> Clone for LazyRow<'a, F>clone
fn clone(&self) -> SelfImplementation of Copy
impl<'a, F: core::marker::Copy> Copy for LazyRow<'a, F>Implementation of Debug
impl<'a, F: core::fmt::Debug> Debug for LazyRow<'a, F>fmt
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::ResultImplementation of Freeze
impl<'a, F> Freeze for LazyRow<'a, F> where &'a [F]: Freeze, Option<&'a [F]>: Freeze + FreezeImplementation of RefUnwindSafe
impl<'a, F> RefUnwindSafe for LazyRow<'a, F> where &'a [F]: RefUnwindSafe, Option<&'a [F]>: RefUnwindSafe + RefUnwindSafeImplementation of Send
impl<'a, F> Send for LazyRow<'a, F> where &'a [F]: Send, Option<&'a [F]>: Send + SendImplementation of Sync
impl<'a, F> Sync for LazyRow<'a, F> where &'a [F]: Sync, Option<&'a [F]>: Sync + SyncImplementation of Unpin
impl<'a, F> Unpin for LazyRow<'a, F> where &'a [F]: Unpin, Option<&'a [F]>: Unpin + UnpinImplementation of UnsafeUnpin
impl<'a, F> UnsafeUnpin for LazyRow<'a, F> where &'a [F]: UnsafeUnpin, Option<&'a [F]>: UnsafeUnpin + UnsafeUnpinImplementation of UnwindSafe
impl<'a, F> UnwindSafe for LazyRow<'a, F> where &'a [F]: UnwindSafe, Option<&'a [F]>: UnwindSafe + UnwindSafeImplementation of Any
impl<T> Any for T where T: 'static + ?SizedImplementation of Borrow
impl<T> Borrow<T> for T where T: ?SizedImplementation of BorrowMut
impl<T> BorrowMut<T> for T where T: ?SizedImplementation of ByRef
impl<T> ByRef<T> for TImplementation of CastableFrom
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT where ST: ?Sized, DT: ?SizedImplementation of CastableFrom
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT where ST: ?Sized, DT: ?SizedImplementation of CloneToUninit
impl<T> CloneToUninit for T where T: CloneImplementation of From
impl<T> From<T> for TImplementation of Imply
impl<T, U> Imply<T> for U where T: ?Sized, U: ?SizedImplementation of Into
impl<T, U> Into<U> for T where U: From<T>Implementation of IntoEither
impl<T> IntoEither for TImplementation of Pointable
impl<T> Pointable for TImplementation of Read
impl<T> Read<Exclusive, BecauseExclusive> for T where T: ?SizedImplementation of Same
impl<T> Same for TImplementation of SupersetOf
impl<SS, SP> SupersetOf<SS> for SP where SS: SubsetOf<SP>Implementation of ToOwned
impl<T> ToOwned for T where T: CloneImplementation of TryFrom
impl<T, U> TryFrom<U> for T where U: Into<T>Implementation of TryInto
impl<T, U> TryInto<U> for T where U: TryFrom<T>
