pub struct SparseTensorCSR {
pub values: Vec<f32>,
pub col_indices: Vec<usize>,
pub row_ptrs: Vec<usize>,
pub shape: Vec<usize>,
pub nnz: usize,
}Expand description
Sparse tensor in CSR (Compressed Sparse Row) format
Fields§
§values: Vec<f32>Non-zero values
col_indices: Vec<usize>Column indices
row_ptrs: Vec<usize>Row pointers
shape: Vec<usize>Shape of the tensor
nnz: usizeNumber of non-zero elements
Implementations§
Source§impl SparseTensorCSR
impl SparseTensorCSR
Sourcepub fn new(
values: Vec<f32>,
col_indices: Vec<usize>,
row_ptrs: Vec<usize>,
shape: Vec<usize>,
) -> Result<Self>
pub fn new( values: Vec<f32>, col_indices: Vec<usize>, row_ptrs: Vec<usize>, shape: Vec<usize>, ) -> Result<Self>
Create a new sparse tensor in CSR format
Sourcepub fn from_coo(coo: &SparseTensorCOO) -> Result<Self>
pub fn from_coo(coo: &SparseTensorCOO) -> Result<Self>
Convert from COO format
Sourcepub fn to_coo(&self) -> Result<SparseTensorCOO>
pub fn to_coo(&self) -> Result<SparseTensorCOO>
Convert to COO format
Trait Implementations§
Source§impl Clone for SparseTensorCSR
impl Clone for SparseTensorCSR
Source§fn clone(&self) -> SparseTensorCSR
fn clone(&self) -> SparseTensorCSR
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SparseTensorCSR
impl RefUnwindSafe for SparseTensorCSR
impl Send for SparseTensorCSR
impl Sync for SparseTensorCSR
impl Unpin for SparseTensorCSR
impl UnwindSafe for SparseTensorCSR
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> 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>
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