pub struct SparseTensor {
pub rows: usize,
pub cols: usize,
pub col_ptrs: Vec<usize>,
pub row_indices: Vec<usize>,
pub values: Vec<f64>,
}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>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>
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>
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
Source§fn eq(&self, other: &SparseTensor) -> bool
fn eq(&self, other: &SparseTensor) -> bool
Tests for
self and other values to be equal, and is used by ==.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