pub struct SparseDelta {
pub indices: Vec<usize>,
pub values: Vec<Precision>,
}Expand description
A sparse update to a right-hand side vector. indices[i] names the
row whose value in b changed by values[i] (additive — pass the
delta, not the new absolute value).
Indices need not be sorted or unique; duplicates are summed.
Fields§
§indices: Vec<usize>Row indices into the RHS vector.
values: Vec<Precision>The additive change at each index. Must be the same length as indices.
Implementations§
Source§impl SparseDelta
impl SparseDelta
Sourcepub fn new(indices: Vec<usize>, values: Vec<Precision>) -> Result<Self>
pub fn new(indices: Vec<usize>, values: Vec<Precision>) -> Result<Self>
Construct a sparse delta. Validates that the two vectors have the
same length; returns Err(InvalidInput) otherwise.
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Construct an empty delta. Useful as the identity element of
apply_delta_to.
Trait Implementations§
Source§impl Clone for SparseDelta
impl Clone for SparseDelta
Source§fn clone(&self) -> SparseDelta
fn clone(&self) -> SparseDelta
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 SparseDelta
impl Debug for SparseDelta
Source§impl<'de> Deserialize<'de> for SparseDelta
impl<'de> Deserialize<'de> for SparseDelta
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
Source§impl PartialEq for SparseDelta
impl PartialEq for SparseDelta
Source§fn eq(&self, other: &SparseDelta) -> bool
fn eq(&self, other: &SparseDelta) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for SparseDelta
impl Serialize for SparseDelta
impl StructuralPartialEq for SparseDelta
Auto Trait Implementations§
impl Freeze for SparseDelta
impl RefUnwindSafe for SparseDelta
impl Send for SparseDelta
impl Sync for SparseDelta
impl Unpin for SparseDelta
impl UnsafeUnpin for SparseDelta
impl UnwindSafe for SparseDelta
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