DrMatrix

Struct DrMatrix 

Source
pub struct DrMatrix<DS> { /* private fields */ }

Implementations§

Source§

impl<T> DrMatrix<Vec<T>>

Source

pub fn new_rnd<F, R>(shape: [usize; 2], rng: &mut R, cb: F) -> Self
where F: FnMut(&mut R, [usize; 2]) -> T, R: Rng,

Source

pub fn with_vec_capacity(shape: [usize; 2]) -> Self

Source§

impl<DA> DrMatrix<VecArray<DA>>
where DA: Array,

Source

pub fn new_rnd<F, R>(shape: [usize; 2], rng: &mut R, cb: F) -> Self
where F: FnMut(&mut R, [usize; 2]) -> DA::Item, R: Rng,

Source

pub fn with_vec_array(cols: usize) -> Self

Source§

impl<DS> DrMatrix<DS>
where DS: StDenseStoRef,

Source

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 data must 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]);
Source

pub fn new_unchecked(shape: [usize; 2], data: DS) -> Self

A faster and unsafe version of new.

Source

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],
    )
);
Source

pub fn data(&self) -> &[DS::Item]

Source

pub fn row(&self, idx: usize) -> &[DS::Item]

Source

pub fn row_iter(&self) -> DrMatrixRowIter<'_, DS::Item>

Source

pub fn row_par_iter( &self, ) -> ParallelIteratorWrapper<DrMatrixRowIter<'_, DS::Item>>

Source

pub fn value(&self, row_idx: usize, col_idx: usize) -> &DS::Item

Source§

impl<DS> DrMatrix<DS>
where DS: StDenseStoMut,

Source

pub fn data_mut(&mut self) -> &mut [DS::Item]

Source

pub fn row_mut(&mut self, idx: usize) -> &mut [DS::Item]

Source

pub fn row_iter_mut(&mut self) -> DrMatrixRowIterMut<'_, DS::Item>

Source

pub fn row_par_iter_mut( &mut self, ) -> ParallelIteratorWrapper<DrMatrixRowIterMut<'_, DS::Item>>

Source

pub fn swap(&mut self, a: [usize; 2], b: [usize; 2])

Source

pub fn two_rows_mut( &mut self, smaller_idx: usize, bigger_idx: usize, ) -> [&mut [DS::Item]; 2]

Source

pub fn value_mut(&mut self, row_idx: usize, col_idx: usize) -> &mut DS::Item

Source§

impl<DS> DrMatrix<DS>
where DS: DynDenseStoRef,

Source

pub fn rows_capacity(&self) -> usize

Source§

impl<DS> DrMatrix<DS>
where DS: DynDenseStoMut,

Source

pub fn clear(&mut self)

Source

pub fn extend<AD>(&mut self, other: &DrMatrix<AD>)
where AD: DynDenseStoMut<Item = DS::Item>, DS::Item: Copy,

Source

pub fn extend_from_clone<AD>(&mut self, other: &DrMatrix<AD>)
where AD: DynDenseStoMut<Item = DS::Item>, DS::Item: Clone,

Source

pub fn row_constructor(&mut self) -> DrMatrixRowConstructor<'_, DS>

Source

pub fn truncate(&mut self, until_row_idx: usize)

Trait Implementations§

Source§

impl<DS: Clone> Clone for DrMatrix<DS>

Source§

fn clone(&self) -> DrMatrix<DS>

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<DS: Debug> Debug for DrMatrix<DS>

Source§

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

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

impl<DS: Default> Default for DrMatrix<DS>

Source§

fn default() -> DrMatrix<DS>

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

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>,

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

impl<DS: Hash> Hash for DrMatrix<DS>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<DS> Matrix for DrMatrix<DS>

Source§

fn cols(&self) -> usize

Source§

fn rows(&self) -> usize

Source§

impl<DS: PartialEq> PartialEq for DrMatrix<DS>

Source§

fn eq(&self, other: &DrMatrix<DS>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<DS: PartialOrd> PartialOrd for DrMatrix<DS>

Source§

fn partial_cmp(&self, other: &DrMatrix<DS>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<DS> Serialize for DrMatrix<DS>
where DS: Serialize,

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<DS: Copy> Copy for DrMatrix<DS>

Source§

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> 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>,