pub struct SparseTensor {
pub rows: usize,
pub cols: usize,
pub col_ptrs: Vec<usize>,
pub row_indices: Vec<usize>,
pub values: Vec<f64>,
pub integer_data: Option<IntegerStorage>,
}Fields§
§rows: usize§cols: usize§col_ptrs: Vec<usize>Column pointers into row_indices/values; length is cols + 1.
row_indices: Vec<usize>Zero-based row indices, sorted within each column.
values: Vec<f64>Floating compatibility view for legacy sparse consumers.
integer_data: Option<IntegerStorage>Exact homogeneous backing storage for typed integer sparse values.
Implementations§
Source§impl SparseTensor
impl SparseTensor
pub fn new( rows: usize, cols: usize, col_ptrs: Vec<usize>, row_indices: Vec<usize>, values: Vec<f64>, ) -> Result<Self, String>
Sourcepub fn new_integer(
rows: usize,
cols: usize,
col_ptrs: Vec<usize>,
row_indices: Vec<usize>,
integer_data: IntegerStorage,
) -> Result<Self, String>
pub fn new_integer( rows: usize, cols: usize, col_ptrs: Vec<usize>, row_indices: Vec<usize>, integer_data: IntegerStorage, ) -> Result<Self, String>
Constructs a sparse matrix backed by an exact integer value buffer.
pub fn zeros(rows: usize, cols: usize) -> Self
pub fn nnz(&self) -> usize
pub fn shape(&self) -> Vec<usize>
pub fn to_dense(&self) -> Result<Tensor, String>
pub fn get(&self, row: usize, col: usize) -> Option<f64>
Sourcepub fn integer_at(&self, row: usize, col: usize) -> Option<IntValue>
pub fn integer_at(&self, row: usize, col: usize) -> Option<IntValue>
Returns an exact stored integer value when this sparse matrix is typed.
pub fn integer_storage(&self) -> Option<&IntegerStorage>
pub fn class_name(&self) -> &'static str
Trait Implementations§
Source§impl Clone for SparseTensor
impl Clone for SparseTensor
Source§fn clone(&self) -> SparseTensor
fn clone(&self) -> SparseTensor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SparseTensor
impl Debug for SparseTensor
Source§impl Display for SparseTensor
impl Display for SparseTensor
Source§impl PartialEq for SparseTensor
impl PartialEq for SparseTensor
impl StructuralPartialEq for SparseTensor
Auto Trait Implementations§
impl Freeze for SparseTensor
impl RefUnwindSafe for SparseTensor
impl Send for SparseTensor
impl Sync for SparseTensor
impl Unpin for SparseTensor
impl UnsafeUnpin for SparseTensor
impl UnwindSafe for SparseTensor
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