orx_v::matrices

Struct V2MatrixRowMajor

Source
pub struct V2MatrixRowMajor<T, V>
where V: NVec<D2, T>,
{ /* private fields */ }
Expand description

A row major matrix.

Trait Implementations§

Source§

impl<T, V> Matrix<T> for V2MatrixRowMajor<T, V>
where V: NVec<D2, T>,

Source§

fn num_rows(&self) -> usize

Number of rows.
Source§

fn num_cols(&self) -> usize

Number of columns.
Source§

fn at(&self, idx: impl IntoIdx<D2>) -> T

Returns the element at the given idx of the matrix. Read more
Source§

fn all(&self) -> impl Iterator<Item = T>

Returns an iterator of all elements of the matrix. The direction of iteration depends on whether the matrix is row-major or column-major. Read more
Source§

fn in_bounds(&self, idx: impl Into<<D2 as Dim>::LeqIdx>) -> bool

Returns true if the given idx is in bounds of the matrix.
Source§

fn try_at(&self, idx: impl IntoIdx<D2>) -> Option<T>

Returns the element at the given idx if it is in_bounds; returns None otherwise.
Source§

fn equality(&self, other: &impl Matrix<T>) -> Equality<D2>
where T: PartialEq,

Returns the equality result of comparing this matrix to the other.
Source§

impl<T, V> MatrixMut<T> for V2MatrixRowMajor<T, V>
where V: NVecMut<D2, T>,

Source§

fn at_mut<Idx: IntoIdx<D2>>(&mut self, idx: Idx) -> &mut T

Returns a mutable reference to the element at the given idx of the matrix. Read more
Source§

fn mut_all<F>(&mut self, f: F)
where F: FnMut(&mut T),

Applies the mutating function f over all elements of the matrix.
Source§

fn reset_all(&mut self, value: T)
where T: PartialEq + Copy,

Sets all elements of the matrix to the given value. This method is often used at initialization stage of algorithms. Read more
Source§

fn set<Idx: IntoIdx<D2>>(&mut self, idx: Idx, value: T)

Sets the element at the given idx of the matrix to the value. Read more
Source§

fn try_at_mut(&mut self, idx: impl IntoIdx<D2>) -> Option<&mut T>

Returns a mutable reference to the element at the idx-th position of the matrix if the index is in_bounds; returns None otherwise.
Source§

impl<T, V> MatrixRowMajor<T> for V2MatrixRowMajor<T, V>
where V: NVec<D2, T>,

Source§

fn row(&self, i: usize) -> impl NVec<D1, T>

Returns the i-th row of the matrix which is a D1 vector.
Source§

fn rows(&self) -> impl Iterator<Item = impl NVec<D1, T>>

Returns an iterator over the rows of the matrix.
Source§

impl<T, V> MatrixRowMajorMut<T> for V2MatrixRowMajor<T, V>
where V: NVecMut<D2, T>,

Source§

fn row_mut(&mut self, i: usize) -> impl NVecMut<D1, T>

Returns a mutable reference to the i-th row of the matrix which is a D1 vector.

Auto Trait Implementations§

§

impl<T, V> Freeze for V2MatrixRowMajor<T, V>
where V: Freeze,

§

impl<T, V> RefUnwindSafe for V2MatrixRowMajor<T, V>

§

impl<T, V> Send for V2MatrixRowMajor<T, V>
where V: Send, T: Send,

§

impl<T, V> Sync for V2MatrixRowMajor<T, V>
where V: Sync, T: Sync,

§

impl<T, V> Unpin for V2MatrixRowMajor<T, V>
where V: Unpin, T: Unpin,

§

impl<T, V> UnwindSafe for V2MatrixRowMajor<T, V>
where V: UnwindSafe, T: 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> 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, 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.