pub struct DrMatrix<DS> { /* private fields */ }Implementations§
Source§impl<DS> DrMatrix<DS>where
DS: StDenseStoRef,
impl<DS> DrMatrix<DS>where
DS: StDenseStoRef,
Sourcepub fn new(shape: [usize; 2], data: DS) -> Self
pub fn new(shape: [usize; 2], data: DS) -> Self
Creates a new DrMatrix from raw parameters.
§Arguments
shape- An array containing the number of rows and columns.data- The matrix data.
§Examples
use mop_structs::matrix::dr_matrix::DrMatrixArray;
let _ = DrMatrixArray::new([2, 4], [1, 2, 3, 4, 5, 6, 7, 8]);§Assertions
- The length of
datamust be equal the number of rows times the number of columns.
ⓘ
use mop_structs::matrix::dr_matrix::DrMatrixRef;
let _ = DrMatrixRef::new([2, 4], &[1, 2, 3]);Sourcepub fn new_unchecked(shape: [usize; 2], data: DS) -> Self
pub fn new_unchecked(shape: [usize; 2], data: DS) -> Self
A faster and unsafe version of new.
Sourcepub fn as_ref(&self) -> DrMatrixRef<'_, DS::Item>
pub fn as_ref(&self) -> DrMatrixRef<'_, DS::Item>
Converts the inner storage to a generic immutable slice storage.
§Examples
use mop_structs::{
doc_tests::dr_matrix_array,
matrix::dr_matrix::DrMatrixRef
};
assert_eq!(
dr_matrix_array().as_ref(),
DrMatrixRef::new(
[4, 5],
&[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
)
);pub fn data(&self) -> &[DS::Item]
pub fn row(&self, idx: usize) -> &[DS::Item]
pub fn row_iter(&self) -> DrMatrixRowIter<'_, DS::Item> ⓘ
pub fn row_par_iter( &self, ) -> ParallelIteratorWrapper<DrMatrixRowIter<'_, DS::Item>>
pub fn value(&self, row_idx: usize, col_idx: usize) -> &DS::Item
Source§impl<DS> DrMatrix<DS>where
DS: StDenseStoMut,
impl<DS> DrMatrix<DS>where
DS: StDenseStoMut,
pub fn data_mut(&mut self) -> &mut [DS::Item]
pub fn row_mut(&mut self, idx: usize) -> &mut [DS::Item]
pub fn row_iter_mut(&mut self) -> DrMatrixRowIterMut<'_, DS::Item> ⓘ
pub fn row_par_iter_mut( &mut self, ) -> ParallelIteratorWrapper<DrMatrixRowIterMut<'_, DS::Item>>
pub fn swap(&mut self, a: [usize; 2], b: [usize; 2])
pub fn two_rows_mut( &mut self, smaller_idx: usize, bigger_idx: usize, ) -> [&mut [DS::Item]; 2]
pub fn value_mut(&mut self, row_idx: usize, col_idx: usize) -> &mut DS::Item
Source§impl<DS> DrMatrix<DS>where
DS: DynDenseStoRef,
impl<DS> DrMatrix<DS>where
DS: DynDenseStoRef,
pub fn rows_capacity(&self) -> usize
Source§impl<DS> DrMatrix<DS>where
DS: DynDenseStoMut,
impl<DS> DrMatrix<DS>where
DS: DynDenseStoMut,
pub fn clear(&mut self)
pub fn extend<AD>(&mut self, other: &DrMatrix<AD>)
pub fn extend_from_clone<AD>(&mut self, other: &DrMatrix<AD>)
pub fn row_constructor(&mut self) -> DrMatrixRowConstructor<'_, DS>
pub fn truncate(&mut self, until_row_idx: usize)
Trait Implementations§
Source§impl<'de, DS> Deserialize<'de> for DrMatrix<DS>where
DS: Deserialize<'de>,
impl<'de, DS> Deserialize<'de> for DrMatrix<DS>where
DS: Deserialize<'de>,
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<DS: PartialOrd> PartialOrd for DrMatrix<DS>
impl<DS: PartialOrd> PartialOrd for DrMatrix<DS>
impl<DS: Copy> Copy for DrMatrix<DS>
impl<DS> StructuralPartialEq for DrMatrix<DS>
Auto Trait Implementations§
impl<DS> Freeze for DrMatrix<DS>where
DS: Freeze,
impl<DS> RefUnwindSafe for DrMatrix<DS>where
DS: RefUnwindSafe,
impl<DS> Send for DrMatrix<DS>where
DS: Send,
impl<DS> Sync for DrMatrix<DS>where
DS: Sync,
impl<DS> Unpin for DrMatrix<DS>where
DS: Unpin,
impl<DS> UnwindSafe for DrMatrix<DS>where
DS: UnwindSafe,
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