[−][src]Struct mop_structs::matrix::csr_matrix::CsrMatrixRowConstructor
Constructs a new valid row in a easy and interactive manner, abstracting away the complexity of the CSR format.
This struct may panic when out of scope. Please see the Drop documentation in
the Trait Implementations section for more information.
Methods
impl<'a, DS, US> CsrMatrixRowConstructor<'a, DS, US> where
DS: DynDenseStoMut,
US: DynDenseStoMut<Item = usize>, [src]
DS: DynDenseStoMut,
US: DynDenseStoMut<Item = usize>,
pub fn commit(self)[src]
Commits the row construction, modifying the internal structure.
Examples
use mop_structs::{ doc_tests::csr_matrix_empty_vec_array, matrix::csr_matrix::CsrMatrixRef }; let mut a = csr_matrix_empty_vec_array(); a.row_constructor().commit(); assert_eq!(a.as_ref(), CsrMatrixRef::new([1, 5], &[], &[], &[0, 0]));
Assertions
- Inserted indices must be less than the number of columns of
Self.
use mop_structs::doc_tests::csr_matrix_empty_vec_array; let mut a = csr_matrix_empty_vec_array(); a.row_constructor().set_value(10, 1).commit();
- Inserted indices must be unique.
use mop_structs::doc_tests::csr_matrix_empty_vec_array; let mut a = csr_matrix_empty_vec_array(); a.row_constructor().set_value(1, 1).set_value(1, 10).commit();
pub unsafe fn commit_unchecked(self)[src]
A faster and unsafe version of commit.
pub fn copy_values_from_row(self, row: &CssSlice<DS::Item>) -> Self where
DS::Item: Copy, [src]
DS::Item: Copy,
Copies all values of row into the current row.
Examples
use mop_structs::{ doc_tests::csr_matrix_empty_vec_array, matrix::csr_matrix::CsrMatrixRef, vec::css::CssSlice }; let mut a = csr_matrix_empty_vec_array(); let b = CssSlice::new(5, &[1, 2], &[0, 1]); a.row_constructor().copy_values_from_row(&b).commit(); assert_eq!(a.as_ref(), CsrMatrixRef::new( [1, 5], &[1, 2], &[0, 1], &[0, 2] ));
pub fn set_value(self, column_idx: usize, value: DS::Item) -> Self[src]
Sets a new value in the current row and column index column_idx.
Examples
use mop_structs::{ doc_tests::csr_matrix_empty_vec_array, matrix::csr_matrix::CsrMatrixRef }; let mut a = csr_matrix_empty_vec_array(); a.row_constructor().set_value(1, 1).commit(); assert_eq!(a.as_ref(), CsrMatrixRef::new([1, 5], &[1], &[1], &[0, 1]));
Trait Implementations
impl<'a, DS, US> Drop for CsrMatrixRowConstructor<'a, DS, US>[src]
fn drop(&mut self)[src]
Some measures are taken to ensure the CSR format and avoid unexpected runtime behavior.
Assertions
- Every single nonempty instance of
CsrRowLayerConstructormust end with a call to thecommitmethod.
use mop_structs::doc_tests::csr_matrix_empty_vec_array; let mut a = csr_matrix_empty_vec_array(); a.row_constructor().set_value(1, 1);
impl<'a, DS: PartialEq, US: PartialEq> PartialEq<CsrMatrixRowConstructor<'a, DS, US>> for CsrMatrixRowConstructor<'a, DS, US>[src]
fn eq(&self, other: &CsrMatrixRowConstructor<'a, DS, US>) -> bool[src]
fn ne(&self, other: &CsrMatrixRowConstructor<'a, DS, US>) -> bool[src]
impl<'a, DS: Debug, US: Debug> Debug for CsrMatrixRowConstructor<'a, DS, US>[src]
Auto Trait Implementations
impl<'a, DS, US> Send for CsrMatrixRowConstructor<'a, DS, US> where
DS: Send,
US: Send,
DS: Send,
US: Send,
impl<'a, DS, US> Sync for CsrMatrixRowConstructor<'a, DS, US> where
DS: Sync,
US: Sync,
DS: Sync,
US: Sync,
Blanket Implementations
impl<T> From for T[src]
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>, [src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,