pub struct SparseVector { /* private fields */ }Expand description
A sparse vector.
Implementations§
Source§impl SparseVector
impl SparseVector
Sourcepub fn from_dense(vec: &[f32]) -> SparseVector
pub fn from_dense(vec: &[f32]) -> SparseVector
Creates a sparse vector from a dense vector.
Sourcepub fn from_map<'a, I: IntoIterator<Item = (&'a i32, &'a f32)>>(
map: I,
dim: i32,
) -> SparseVector
pub fn from_map<'a, I: IntoIterator<Item = (&'a i32, &'a f32)>>( map: I, dim: i32, ) -> SparseVector
Creates a sparse vector from a map of non-zero elements.
Sourcepub fn dimensions(&self) -> i32
pub fn dimensions(&self) -> i32
Returns the number of dimensions.
Trait Implementations§
Source§impl Clone for SparseVector
impl Clone for SparseVector
Source§fn clone(&self) -> SparseVector
fn clone(&self) -> SparseVector
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 moreSource§impl Debug for SparseVector
impl Debug for SparseVector
Source§impl PartialEq for SparseVector
impl PartialEq for SparseVector
impl StructuralPartialEq for SparseVector
Auto Trait Implementations§
impl Freeze for SparseVector
impl RefUnwindSafe for SparseVector
impl Send for SparseVector
impl Sync for SparseVector
impl Unpin for SparseVector
impl UnwindSafe for SparseVector
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