pub struct ZeroSpVec<N>where
N: Num,{ /* private fields */ }Expand description
ZeroSpVecは0要素を疎とした過疎ベクトルを実装です indices と valuesを持ち indicesは要素のインデックスを保持し、 valuesは要素の値を保持します
要素はindicesの昇順でソートされていることを保証します
Implementations§
Source§impl<N> ZeroSpVec<N>
impl<N> ZeroSpVec<N>
Source§impl<N> ZeroSpVec<N>
impl<N> ZeroSpVec<N>
Sourcepub fn dot_normalized<R>(&self, other: &Self) -> R
pub fn dot_normalized<R>(&self, other: &Self) -> R
pub fn cosine_similarity_normalized<R>(&self, other: &Self) -> R
Sourcepub fn hadamard_normalized(&self, other: &Self) -> Self
pub fn hadamard_normalized(&self, other: &Self) -> Self
Source§impl<N> ZeroSpVec<N>where
N: Num,
impl<N> ZeroSpVec<N>where
N: Num,
pub fn new() -> Self
pub fn with_capacity(cap: usize) -> Self
pub fn reserve(&mut self, additional: usize)
pub fn shrink_to_fit(&mut self)
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn capacity(&self) -> usize
pub fn nnz(&self) -> usize
pub fn add_dim(&mut self, dim: usize)
pub fn clear(&mut self)
pub fn push(&mut self, elem: N)
pub fn pop(&mut self) -> Option<N>
pub fn get(&self, index: usize) -> Option<&N>
pub fn get_ind(&self, index: usize) -> Option<usize>
pub fn from_vec(vec: Vec<N>) -> Self
pub fn iter(&self) -> ZeroSpVecIter<'_, N> ⓘ
pub fn raw_iter(&self) -> ZeroSpVecRawIter<'_, N> ⓘ
Trait Implementations§
Source§impl<'de, N> Deserialize<'de> for ZeroSpVec<N>
impl<'de, N> Deserialize<'de> for ZeroSpVec<N>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<N: Num + Send> Send for ZeroSpVec<N>
impl<N: Num + Sync> Sync for ZeroSpVec<N>
Auto Trait Implementations§
impl<N> Freeze for ZeroSpVec<N>where
N: Freeze,
impl<N> RefUnwindSafe for ZeroSpVec<N>where
N: RefUnwindSafe,
impl<N> Unpin for ZeroSpVec<N>where
N: Unpin,
impl<N> UnwindSafe for ZeroSpVec<N>where
N: UnwindSafe + RefUnwindSafe,
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