pub struct MemoryAnalysis {
pub format: SparseFormat,
pub nnz: usize,
pub estimated_memory: usize,
pub dense_memory: usize,
pub compression_ratio: f32,
pub overhead_per_nnz: f32,
pub matrix_dimensions: (usize, usize),
pub memory_breakdown: MemoryBreakdown,
pub metrics: HashMap<String, f64>,
}Expand description
Comprehensive memory analysis result for sparse tensors
This struct provides detailed information about memory usage patterns, compression characteristics, and efficiency metrics for sparse tensor storage.
Fields§
§format: SparseFormatSparse format being analyzed
nnz: usizeNumber of non-zero elements
estimated_memory: usizeEstimated memory usage for sparse representation (bytes)
dense_memory: usizeMemory usage if stored as dense tensor (bytes)
compression_ratio: f32Compression ratio (dense_memory / sparse_memory)
overhead_per_nnz: f32Memory overhead per non-zero element (bytes)
matrix_dimensions: (usize, usize)Matrix dimensions (rows, columns)
memory_breakdown: MemoryBreakdownMemory breakdown by component
metrics: HashMap<String, f64>Additional memory metrics
Implementations§
Source§impl MemoryAnalysis
impl MemoryAnalysis
Sourcepub fn new(
format: SparseFormat,
nnz: usize,
matrix_dimensions: (usize, usize),
) -> Self
pub fn new( format: SparseFormat, nnz: usize, matrix_dimensions: (usize, usize), ) -> Self
Create a new memory analysis result
Sourcepub fn compression_effectiveness(&self) -> f32
pub fn compression_effectiveness(&self) -> f32
Calculate compression effectiveness score (0-1, higher is better)
Sourcepub fn sparsity_ratio(&self) -> f32
pub fn sparsity_ratio(&self) -> f32
Get sparsity ratio (percentage of zero elements)
Sourcepub fn is_memory_efficient(&self) -> bool
pub fn is_memory_efficient(&self) -> bool
Check if sparse representation is memory efficient
Sourcepub fn memory_efficiency_rating(&self) -> String
pub fn memory_efficiency_rating(&self) -> String
Get memory efficiency rating (Poor, Fair, Good, Excellent)
Sourcepub fn add_metric(&mut self, key: String, value: f64)
pub fn add_metric(&mut self, key: String, value: f64)
Add a custom memory metric
Trait Implementations§
Source§impl Clone for MemoryAnalysis
impl Clone for MemoryAnalysis
Auto Trait Implementations§
impl Freeze for MemoryAnalysis
impl RefUnwindSafe for MemoryAnalysis
impl Send for MemoryAnalysis
impl Sync for MemoryAnalysis
impl Unpin for MemoryAnalysis
impl UnsafeUnpin for MemoryAnalysis
impl UnwindSafe for MemoryAnalysis
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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