pub struct BlockSparseLayout<S: Sector> { /* private fields */ }Expand description
Interpretation half of the block-sparse tensor split.
Holds the allowed-block enumeration (sorted by coordinate, packed
offsets), the per-leg sector indices, the conserved flux, the
cached logical shape, and the memory order the paired
BlockSparseStorage is laid out in.
Construction goes through new, which enumerates
flux-allowed blocks and produces a packed layout. Layout-internal
invariants (sector conservation, coord uniqueness, no-gap
packing) hold by construction; the storage-layout boundary check
happens in
TensorData::new.
Implementations§
Source§impl<S: Sector> BlockSparseLayout<S>
impl<S: Sector> BlockSparseLayout<S>
Sourcepub fn new(indices: Vec<QNIndex<S>>, flux: S, order: MemoryOrder) -> Self
pub fn new(indices: Vec<QNIndex<S>>, flux: S, order: MemoryOrder) -> Self
Construct a layout by enumerating flux-allowed blocks.
The resulting layout has blocks sorted by coordinate
(lexicographic) with packed offsets (no gaps or overlaps),
every block satisfying the flux-conservation law, and a
cached storage_extent equal to the sum of allowed block
sizes.
Sourcepub fn num_blocks(&self) -> usize
pub fn num_blocks(&self) -> usize
Number of stored (non-zero) blocks.
Sourcepub fn block_metas(&self) -> &[BlockMeta]
pub fn block_metas(&self) -> &[BlockMeta]
Block metadata (sorted by coordinate).
Sourcepub fn order(&self) -> MemoryOrder
pub fn order(&self) -> MemoryOrder
Memory order the paired storage is laid out in.
Sourcepub fn block_shape(&self, coord: &BlockCoord) -> Option<Vec<usize>>
pub fn block_shape(&self, coord: &BlockCoord) -> Option<Vec<usize>>
Shape of a specific block, or None if the coordinate is out of range.
Sourcepub fn is_allowed_block(&self, coord: &BlockCoord) -> bool
pub fn is_allowed_block(&self, coord: &BlockCoord) -> bool
Check whether a block coordinate satisfies the flux conservation law.
Trait Implementations§
Source§impl<S: Clone + Sector> Clone for BlockSparseLayout<S>
impl<S: Clone + Sector> Clone for BlockSparseLayout<S>
Source§fn clone(&self) -> BlockSparseLayout<S>
fn clone(&self) -> BlockSparseLayout<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<T, S: Sector> StorageFor<BlockSparseLayout<S>> for BlockSparseStorage<T>
Source§impl<S: Sector> TensorLayout for BlockSparseLayout<S>
impl<S: Sector> TensorLayout for BlockSparseLayout<S>
Auto Trait Implementations§
impl<S> Freeze for BlockSparseLayout<S>where
S: Freeze,
impl<S> RefUnwindSafe for BlockSparseLayout<S>where
S: RefUnwindSafe,
impl<S> Send for BlockSparseLayout<S>where
S: Send,
impl<S> Sync for BlockSparseLayout<S>where
S: Sync,
impl<S> Unpin for BlockSparseLayout<S>where
S: Unpin,
impl<S> UnsafeUnpin for BlockSparseLayout<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for BlockSparseLayout<S>where
S: UnwindSafe,
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> 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 more