Struct StructuredStorage
pub struct StructuredStorage<T> { /* private fields */ }Expand description
Structured tensor snapshot storage.
data and strides describe the payload tensor, while axis_classes
describes how logical axes map onto payload axes. Logical flat-buffer
semantics are column-major.
Implementations§
§impl<T> StructuredStorage<T>
impl<T> StructuredStorage<T>
pub fn new(
data: Vec<T>,
payload_dims: Vec<usize>,
strides: Vec<isize>,
axis_classes: Vec<usize>,
) -> Result<StructuredStorage<T>, Error>
pub fn new( data: Vec<T>, payload_dims: Vec<usize>, strides: Vec<isize>, axis_classes: Vec<usize>, ) -> Result<StructuredStorage<T>, Error>
Creates a structured payload snapshot from explicit payload metadata.
payload_dims and strides describe the compressed payload tensor,
while axis_classes maps logical axes onto payload axes in canonical
first-appearance order.
pub fn from_dense_col_major(
data: Vec<T>,
logical_dims: &[usize],
) -> StructuredStorage<T>
pub fn from_dense_col_major( data: Vec<T>, logical_dims: &[usize], ) -> StructuredStorage<T>
Creates a dense structured snapshot from column-major logical data.
pub fn from_diag_col_major(
diag_data: Vec<T>,
logical_rank: usize,
) -> StructuredStorage<T>
pub fn from_diag_col_major( diag_data: Vec<T>, logical_rank: usize, ) -> StructuredStorage<T>
Creates a diagonal structured snapshot from column-major diagonal data.
pub fn payload_dims(&self) -> &[usize]
pub fn payload_dims(&self) -> &[usize]
Returns the payload tensor dimensions.
pub fn axis_classes(&self) -> &[usize]
pub fn axis_classes(&self) -> &[usize]
Returns the canonical logical-to-payload axis classes.
pub fn logical_dims(&self) -> Vec<usize>
pub fn logical_dims(&self) -> Vec<usize>
Returns the logical dimensions derived from payload_dims and axis_classes.
pub fn logical_rank(&self) -> usize
pub fn logical_rank(&self) -> usize
Returns the logical rank.
pub fn dense_col_major_view_if_contiguous(&self) -> Option<&[T]>
pub fn dense_col_major_view_if_contiguous(&self) -> Option<&[T]>
Returns a borrowed view when the logical tensor is dense and the payload is already stored contiguously in column-major order.
§impl<T> StructuredStorage<T>where
T: Clone,
impl<T> StructuredStorage<T>where
T: Clone,
pub fn payload_col_major_vec(&self) -> Vec<T>
pub fn payload_col_major_vec(&self) -> Vec<T>
Materializes the payload tensor as a contiguous column-major buffer.
pub fn permute_logical_axes(&self, perm: &[usize]) -> StructuredStorage<T>
pub fn permute_logical_axes(&self, perm: &[usize]) -> StructuredStorage<T>
Returns a copy of the storage with logical axes permuted.
§impl<T> StructuredStorage<T>where
T: Copy,
impl<T> StructuredStorage<T>where
T: Copy,
pub fn map_copy<U>(&self, f: impl FnMut(T) -> U) -> StructuredStorage<U>
pub fn map_copy<U>(&self, f: impl FnMut(T) -> U) -> StructuredStorage<U>
Maps payload elements while preserving payload metadata and axis classes.
§impl<T> StructuredStorage<T>
impl<T> StructuredStorage<T>
pub fn logical_dense_col_major_vec(&self) -> Vec<T>
pub fn logical_dense_col_major_vec(&self) -> Vec<T>
Materializes the logical tensor as a contiguous column-major dense buffer.
Repeated entries in axis_classes encode equality constraints between
logical axes. Logical indices that violate those constraints are
structural zeros in the dense materialization.
Trait Implementations§
§impl<T> Clone for StructuredStorage<T>where
T: Clone,
impl<T> Clone for StructuredStorage<T>where
T: Clone,
§fn clone(&self) -> StructuredStorage<T>
fn clone(&self) -> StructuredStorage<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<T> Debug for StructuredStorage<T>where
T: Debug,
impl<T> Debug for StructuredStorage<T>where
T: Debug,
§impl<T> PartialEq for StructuredStorage<T>where
T: PartialEq,
impl<T> PartialEq for StructuredStorage<T>where
T: PartialEq,
impl<T> StructuralPartialEq for StructuredStorage<T>
Auto Trait Implementations§
impl<T> Freeze for StructuredStorage<T>
impl<T> RefUnwindSafe for StructuredStorage<T>where
T: RefUnwindSafe,
impl<T> Send for StructuredStorage<T>where
T: Send,
impl<T> Sync for StructuredStorage<T>where
T: Sync,
impl<T> Unpin for StructuredStorage<T>where
T: Unpin,
impl<T> UnwindSafe for StructuredStorage<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§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,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
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