pub struct CompressedMatrix<T> {
pub matrixid: u64,
pub original_rows: usize,
pub original_cols: usize,
pub compressed_blocks: Vec<CompressedBlock>,
pub compression_algorithm: CompressionAlgorithm,
pub block_size: usize,
pub metadata: CompressionMetadata,
/* private fields */
}
Expand description
Compressed sparse matrix representation
Fields§
§matrixid: u64
§original_rows: usize
§original_cols: usize
§compressed_blocks: Vec<CompressedBlock>
§compression_algorithm: CompressionAlgorithm
§block_size: usize
§metadata: CompressionMetadata
Implementations§
Source§impl<T> CompressedMatrix<T>
impl<T> CompressedMatrix<T>
Sourcepub fn new(
matrix_id: u64,
original_rows: usize,
original_cols: usize,
compression_algorithm: CompressionAlgorithm,
block_size: usize,
) -> Self
pub fn new( matrix_id: u64, original_rows: usize, original_cols: usize, compression_algorithm: CompressionAlgorithm, block_size: usize, ) -> Self
Create a new compressed matrix
Sourcepub fn add_block(&mut self, block: CompressedBlock)
pub fn add_block(&mut self, block: CompressedBlock)
Add a compressed block
Sourcepub fn get_block(&self, block_id: &BlockId) -> Option<&CompressedBlock>
pub fn get_block(&self, block_id: &BlockId) -> Option<&CompressedBlock>
Get block by ID
Sourcepub fn get_block_mut(
&mut self,
block_id: &BlockId,
) -> Option<&mut CompressedBlock>
pub fn get_block_mut( &mut self, block_id: &BlockId, ) -> Option<&mut CompressedBlock>
Get mutable block by ID
Sourcepub fn remove_block(&mut self, block_id: &BlockId) -> Option<CompressedBlock>
pub fn remove_block(&mut self, block_id: &BlockId) -> Option<CompressedBlock>
Remove a block
Sourcepub fn get_blocks_by_type(&self, block_type: BlockType) -> Vec<&CompressedBlock>
pub fn get_blocks_by_type(&self, block_type: BlockType) -> Vec<&CompressedBlock>
Get blocks of specific type
Sourcepub fn block_count(&self) -> usize
pub fn block_count(&self) -> usize
Get total number of blocks
Sourcepub fn compressed_size(&self) -> usize
pub fn compressed_size(&self) -> usize
Get total compressed size
Sourcepub fn original_size(&self) -> usize
pub fn original_size(&self) -> usize
Get total original size
Sourcepub fn compression_ratio(&self) -> f64
pub fn compression_ratio(&self) -> f64
Get compression ratio
Sourcepub fn verify_integrity(&self) -> Result<(), String>
pub fn verify_integrity(&self) -> Result<(), String>
Check data integrity
Sourcepub fn memory_footprint(&self) -> usize
pub fn memory_footprint(&self) -> usize
Get memory footprint
Sourcepub fn optimize_blocks(&mut self)
pub fn optimize_blocks(&mut self)
Optimize block organization
Sourcepub fn get_blocks_row_major(&self) -> Vec<&CompressedBlock>
pub fn get_blocks_row_major(&self) -> Vec<&CompressedBlock>
Get blocks in row-major order
Sourcepub fn export_metadata(&self) -> MatrixMetadataExport
pub fn export_metadata(&self) -> MatrixMetadataExport
Export metadata for persistence
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for CompressedMatrix<T>
impl<T> RefUnwindSafe for CompressedMatrix<T>where
T: RefUnwindSafe,
impl<T> Send for CompressedMatrix<T>where
T: Send,
impl<T> Sync for CompressedMatrix<T>where
T: Sync,
impl<T> Unpin for CompressedMatrix<T>where
T: Unpin,
impl<T> UnwindSafe for CompressedMatrix<T>where
T: 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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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