ZeroSpVec

Struct ZeroSpVec 

Source
pub struct ZeroSpVec<N>
where N: Num,
{ /* private fields */ }
Expand description

ZeroSpVecは0要素を疎とした過疎ベクトルを実装です indices と valuesを持ち indicesは要素のインデックスを保持し、 valuesは要素の値を保持します

要素はindicesの昇順でソートされていることを保証します

Trait Implementations§

Source§

impl<N> Clone for ZeroSpVec<N>
where N: Num,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<N: Num + Debug> Debug for ZeroSpVec<N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<N> Default for ZeroSpVec<N>
where N: Num,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, N> Deserialize<'de> for ZeroSpVec<N>
where N: Num + Deserialize<'de> + Copy,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<N> Drop for ZeroSpVec<N>
where N: Num,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T> From<Vec<T>> for ZeroSpVec<T>
where T: Num,

Source§

fn from(vec: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, N> From<ZeroSpVecRawIter<'a, N>> for ZeroSpVec<N>
where N: Num + Copy,

Source§

fn from(iter: ZeroSpVecRawIter<'a, N>) -> Self

Converts to this type from the input type.
Source§

impl<N> Index<usize> for ZeroSpVec<N>
where N: Num,

Source§

type Output = N

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<N> Serialize for ZeroSpVec<N>
where N: Num + Serialize + Copy,

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<N> ZeroSpVecTrait<N> for ZeroSpVec<N>
where N: Num,

Source§

unsafe fn raw_push(&mut self, index: usize, value: N)

raw_pushは、要素を追加するためのメソッドです。 ただし全体の長さを考慮しませんのであとでlenを更新する必要があります。

§Arguments
  • index - 追加する要素のインデックス
  • value - 追加する要素の値
Source§

fn remove(&mut self, index: usize) -> N

removeメソッド

index 番目の要素を削除し、削除した要素を返します。

  • 論理インデックス index が物理的に存在すれば、その値を返す
  • 物理的になければ(= デフォルト扱いだった)デフォルト値を返す
§Arguments
  • index - 削除する要素の論理インデックス
§Returns
  • N - 削除した要素の値
Source§

unsafe fn from_sparse_iter( iter: impl Iterator<Item = (usize, N)>, len: usize, ) -> Self

Build from sparse iterator that yields only non-zero elements (idx, value). This avoids allocating a full dense Vec when most entries are zero. unsafeにするべき

Source§

unsafe fn ind_ptr(&self) -> *mut u32

Source§

unsafe fn val_ptr(&self) -> *mut N

Source§

fn new() -> Self

Source§

fn with_capacity(cap: usize) -> Self

Source§

fn reserve(&mut self, additional: usize)

Source§

fn shrink_to_fit(&mut self)

Source§

fn is_empty(&self) -> bool

Source§

fn len(&self) -> usize

Source§

fn len_mut(&mut self) -> &mut usize

Source§

fn capacity(&self) -> usize

Source§

fn nnz(&self) -> usize

Source§

fn add_dim(&mut self, dim: usize)

Source§

fn clear(&mut self)

Source§

fn push(&mut self, elem: N)

Source§

fn pop(&mut self) -> Option<N>

Source§

fn get(&self, index: usize) -> Option<&N>

Source§

fn get_ind(&self, index: usize) -> Option<usize>

Source§

fn from_vec(vec: Vec<N>) -> Self

Source§

unsafe fn from_raw_iter( iter: impl Iterator<Item = (usize, N)>, len: usize, ) -> Self

Source§

fn iter(&self) -> ZeroSpVecIter<'_, N>

Source§

fn raw_iter(&self) -> ZeroSpVecRawIter<'_, N>

Source§

impl<N: Num + Send> Send for ZeroSpVec<N>

Source§

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>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,