pub struct MatrixView<T, S> { /* private fields */ }
Expand description

A view into some or all of a matrix.

A MatrixView has a similar relationship to a Matrix as a &str has to a String, or an array slice to an array. A MatrixView cannot resize its source, and may span only a portion of the source Matrix in each dimension.

However a MatrixView is generic not only over the type of the data in the Matrix, but also over the way the Matrix is ‘sliced’ and the two are orthogonal to each other.

MatrixView closely mirrors the API of Matrix, minus resizing methods which are not available. Methods that create a new matrix do not return a MatrixView, they return a Matrix.

Implementations§

source§

impl<T, S> MatrixView<T, S>where
    S: MatrixRef<T>,

MatrixView methods which require only read access via a MatrixRef source.

source

pub fn from(source: S) -> MatrixView<T, S>

Creates a MatrixView from a source of some type.

The lifetime of the source determines the lifetime of the MatrixView created. If the MatrixView is created from a reference to a Matrix, then the MatrixView cannot live longer than the Matrix referenced.

source

pub fn source(self) -> S

Consumes the matrix view, yielding the source it was created from.

source

pub fn source_ref(&self) -> &S

Gives a reference to the matrix view’s source. This should typically not be needed since Easy ML APIs which take MatrixRefs as inputs like iterators are already wrapped for you as methods on MatrixView.

source

pub fn source_ref_mut(&mut self) -> &mut S

Gives a mutable reference to the matrix view’s source. This should typically not be needed since Easy ML APIs which take MatrixRefs as inputs like iterators are already wrapped for you as methods on MatrixView.

source

pub fn size(&self) -> (Row, Column)

Returns the dimensionality of this matrix view in Row, Column format

source

pub fn rows(&self) -> Row

Gets the number of rows visible to this matrix view.

source

pub fn columns(&self) -> Column

Gets the number of columns visible to this matrix view.

source

pub fn data_layout(&self) -> DataLayout

Gets the data layout this MatrixView’s source uses to store its data.

See Matrix layout and iterator performance

source

pub fn get_reference(&self, row: Row, column: Column) -> &T

Gets a reference to the value at this row and column. Rows and Columns are 0 indexed.

Panics

Panics if the index is out of range.

source

pub fn try_get_reference(&self, row: Row, column: Column) -> Option<&T>

Gets a reference to the value at the row and column if the index is in range. Otherwise returns None.

source

pub unsafe fn get_reference_unchecked(&self, row: Row, column: Column) -> &T

Gets a reference to the value at the index without doing any bounds checking. For a safe alternative see try_get_reference.

Safety

Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used. Valid indexes are defined as in MatrixRef.

source

pub fn column_reference_iter(
    &self,
    column: Column
) -> ColumnReferenceIterator<'_, T, S>

Returns an iterator over references to a column vector in this matrix view. Columns are 0 indexed.

Panics

Panics if the column is not visible to this view.

source

pub fn row_reference_iter(&self, row: Row) -> RowReferenceIterator<'_, T, S>

Returns an iterator over references to a row vector in this matrix view. Rows are 0 indexed.

Panics

Panics if the row is not visible to this view.

source

pub fn column_major_reference_iter(
    &self
) -> ColumnMajorReferenceIterator<'_, T, S>

Returns a column major iterator over references to all values in this matrix view, proceeding through each column in order.

source

pub fn row_major_reference_iter(&self) -> RowMajorReferenceIterator<'_, T, S>

Returns a row major iterator over references to all values in this matrix view, proceeding through each row in order.

source

pub fn diagonal_reference_iter(&self) -> DiagonalReferenceIterator<'_, T, S>

Returns an iterator over references to the main diagonal in this matrix view.

source§

impl<T, S> MatrixView<T, S>where
    T: Clone,
    S: MatrixRef<T>,

MatrixView methods which require only read access via a MatrixRef source and a clonable type.

source

pub fn get(&self, row: Row, column: Column) -> T

Gets a copy of the value at this row and column. Rows and Columns are 0 indexed.

Panics

Panics if the index is out of range.

source

pub fn column_iter(&self, column: Column) -> ColumnIterator<'_, T, S>

Returns an iterator over a column vector in this matrix view. Columns are 0 indexed.

If you have a matrix such as:

[
   1, 2, 3
   4, 5, 6
   7, 8, 9
]

then a column of 0, 1, and 2 will yield [1, 4, 7], [2, 5, 8] and [3, 6, 9] respectively. If you do not need to copy the elements use column_reference_iter instead.

Panics

Panics if the column does not exist in this matrix.

source

pub fn row_iter(&self, row: Row) -> RowIterator<'_, T, S>

Returns an iterator over a row vector in this matrix view. Rows are 0 indexed.

If you have a matrix such as:

[
   1, 2, 3
   4, 5, 6
   7, 8, 9
]

then a row of 0, 1, and 2 will yield [1, 2, 3], [4, 5, 6] and [7, 8, 9] respectively. If you do not need to copy the elements use row_reference_iter instead.

Panics

Panics if the row does not exist in this matrix.

source

pub fn column_major_iter(&self) -> ColumnMajorIterator<'_, T, S>

Returns a column major iterator over all values in this matrix view, proceeding through each column in order.

If you have a matrix such as:

[
   1, 2
   3, 4
]

then the iterator will yield [1, 3, 2, 4]. If you do not need to copy the elements use column_major_reference_iter instead.

source

pub fn row_major_iter(&self) -> RowMajorIterator<'_, T, S>

Returns a row major iterator over all values in this matrix view, proceeding through each row in order.

If you have a matrix such as:

[
   1, 2
   3, 4
]

then the iterator will yield [1, 2, 3, 4]. If you do not need to copy the elements use row_major_reference_iter instead.

source

pub fn diagonal_iter(&self) -> DiagonalIterator<'_, T, S>

Returns a iterator over the main diagonal of this matrix view.

If you have a matrix such as:

[
   1, 2
   3, 4
]

then the iterator will yield [1, 4]. If you do not need to copy the elements use diagonal_reference_iter instead.

Examples

Computing a trace

use easy_ml::matrices::Matrix;
use easy_ml::matrices::views::MatrixView;
let view = MatrixView::from(Matrix::from(vec![
    vec![ 1, 2, 3 ],
    vec![ 4, 5, 6 ],
    vec![ 7, 8, 9 ],
]));
let trace: i32 = view.diagonal_iter().sum();
assert_eq!(trace, 1 + 5 + 9);
source

pub fn map<U>(&self, mapping_function: impl Fn(T) -> U) -> Matrix<U>where
    U: Clone,

Creates and returns a new matrix with all values from the original with the function applied to each.

Exmples
use easy_ml::matrices::Matrix;
use easy_ml::matrices::views::MatrixView;
let x = MatrixView::from(Matrix::from(vec![
   vec![ 0.0, 1.2 ],
   vec![ 5.8, 6.9 ]]));
let y = x.map(|element| element > 2.0);
let result = Matrix::from(vec![
   vec![ false, false ],
   vec![ true, true ]]);
assert_eq!(&y, &result);
source

pub fn map_with_index<U>(
    &self,
    mapping_function: impl Fn(T, Row, Column) -> U
) -> Matrix<U>where
    U: Clone,

Creates and returns a new matrix with all values from the original and the index of each value mapped by a function. This can be used to perform elementwise operations that are not defined on the Matrix type itself.

source§

impl<T, S> MatrixView<T, S>where
    S: MatrixMut<T>,

MatrixView methods which require mutable access via a MatrixMut source.

source

pub fn get_reference_mut(&mut self, row: Row, column: Column) -> &mut T

Gets a mutable reference to the value at this row and column. Rows and Columns are 0 indexed.

Panics

Panics if the index is out of range.

source

pub fn set(&mut self, row: Row, column: Column, value: T)

Sets a new value to this row and column. Rows and Columns are 0 indexed.

Panics

Panics if the index is out of range.

source

pub fn try_get_reference_mut(
    &mut self,
    row: Row,
    column: Column
) -> Option<&mut T>

Gets a mutable reference to the value at the row and column if the index is in range. Otherwise returns None.

source

pub unsafe fn get_reference_unchecked_mut(
    &mut self,
    row: Row,
    column: Column
) -> &mut T

Gets a mutable reference to the value at the index without doing any bounds checking. For a safe alternative see try_get_reference_mut.

Safety

Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used. Valid indexes are defined as in MatrixRef.

source§

impl<T, S> MatrixView<T, S>where
    S: MatrixMut<T> + NoInteriorMutability,

MatrixView methods which require mutable access via a MatrixMut source and no interior mutability.

source

pub fn column_reference_mut_iter(
    &mut self,
    column: Column
) -> ColumnReferenceMutIterator<'_, T, S>

Returns an iterator over mutable references to a column vector in this matrix view. Columns are 0 indexed.

Panics

Panics if the column is not visible to this view.

source

pub fn row_reference_mut_iter(
    &mut self,
    row: Row
) -> RowReferenceMutIterator<'_, T, S>

Returns an iterator over mutable references to a row vector in this matrix view. Rows are 0 indexed.

Panics

Panics if the row is not visible to this view.

source

pub fn column_major_reference_mut_iter(
    &mut self
) -> ColumnMajorReferenceMutIterator<'_, T, S>

Returns a column major iterator over mutable references to all values in this matrix view, proceeding through each column in order.

source

pub fn row_major_reference_mut_iter(
    &mut self
) -> RowMajorReferenceMutIterator<'_, T, S>

Returns a row major iterator over mutable references to all values in this matrix view, proceeding through each row in order.

source

pub fn diagonal_reference_mut_iter(
    &mut self
) -> DiagonalReferenceMutIterator<'_, T, S>

Returns an iterator over mutable references to the main diagonal in this matrix view.

source§

impl<T, S> MatrixView<T, S>where
    T: Clone,
    S: MatrixMut<T>,

MatrixView methods which require mutable access via a MatrixMut source and a clonable type.

source

pub fn map_mut(&mut self, mapping_function: impl Fn(T) -> T)

Applies a function to all values in the matrix view, modifying the source in place.

Examples
use easy_ml::matrices::Matrix;
use easy_ml::matrices::views::MatrixView;
let mut matrix = Matrix::from(vec![
   vec![ 0.0, 1.2 ],
   vec![ 5.8, 6.9 ]]);
{
   let mut view = MatrixView::from(&mut matrix);
   view.map_mut(|x| x + 1.0);
}
let result = Matrix::from(vec![
   vec![ 1.0, 2.2 ],
   vec![ 6.8, 7.9 ]]);
assert_eq!(result, matrix);
source

pub fn map_mut_with_index(
    &mut self,
    mapping_function: impl Fn(T, Row, Column) -> T
)

Applies a function to all values and each value’s index in the matrix view, modifying the source in place.

Trait Implementations§

source§

impl<T, S> Add<&Matrix<T>> for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise addition for a referenced matrix view and a referenced matrix

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &Matrix<T>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S> Add<&Matrix<T>> for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise addition for a matrix view and a referenced matrix

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &Matrix<T>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S> Add<&MatrixView<T, S>> for &Matrix<T>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise addition for a referenced matrix and a referenced matrix view

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &MatrixView<T, S>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S> Add<&MatrixView<T, S>> for Matrix<T>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise addition for a matrix and a referenced matrix view

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &MatrixView<T, S>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S1, S2> Add<&MatrixView<T, S2>> for &MatrixView<T, S1>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S1: MatrixRef<T> + NoInteriorMutability,
    S2: MatrixRef<T> + NoInteriorMutability,

Elementwise addition for two referenced matrix views

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &MatrixView<T, S2>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S1, S2> Add<&MatrixView<T, S2>> for MatrixView<T, S1>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S1: MatrixRef<T> + NoInteriorMutability,
    S2: MatrixRef<T> + NoInteriorMutability,

Elementwise addition for two matrix views with one referenced

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &MatrixView<T, S2>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S> Add<&T> for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix view and scalar by reference. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &T) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S> Add<&T> for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix viiew by value and scalar by reference. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &T) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S> Add<Matrix<T>> for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise addition for a referenced matrix view and a matrix

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Matrix<T>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S> Add<Matrix<T>> for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise addition for a matrix view and a matrix

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Matrix<T>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S> Add<MatrixView<T, S>> for &Matrix<T>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise addition for a referenced matrix and a matrix view

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: MatrixView<T, S>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S> Add<MatrixView<T, S>> for Matrix<T>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise addition for a matrix and a matrix view

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: MatrixView<T, S>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S1, S2> Add<MatrixView<T, S2>> for &MatrixView<T, S1>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S1: MatrixRef<T> + NoInteriorMutability,
    S2: MatrixRef<T> + NoInteriorMutability,

Elementwise addition for two matrix views with one referenced

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: MatrixView<T, S2>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S1, S2> Add<MatrixView<T, S2>> for MatrixView<T, S1>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S1: MatrixRef<T> + NoInteriorMutability,
    S2: MatrixRef<T> + NoInteriorMutability,

Elementwise addition for two matrix views

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: MatrixView<T, S2>) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S> Add<T> for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix view by reference and scalar by value. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
source§

impl<T, S> Add<T> for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix view and scalar by value. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
source§

impl<T: Clone, S: Clone> Clone for MatrixView<T, S>

source§

fn clone(&self) -> MatrixView<T, S>

Returns a copy 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<T: Debug, S: Debug> Debug for MatrixView<T, S>

source§

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

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

impl<T, S> Display for MatrixView<T, S>where
    T: Display,
    S: MatrixRef<T>,

Any matrix view of a Displayable type implements Display

You can control the precision of the formatting using format arguments, i.e. format!("{:.3}", matrix)

source§

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

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

impl<T, S> Div<&T> for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix view and scalar by reference. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the / operator.
source§

fn div(self, rhs: &T) -> Self::Output

Performs the / operation. Read more
source§

impl<T, S> Div<&T> for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix viiew by value and scalar by reference. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the / operator.
source§

fn div(self, rhs: &T) -> Self::Output

Performs the / operation. Read more
source§

impl<T, S> Div<T> for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix view by reference and scalar by value. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the / operator.
source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
source§

impl<T, S> Div<T> for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix view and scalar by value. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the / operator.
source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
source§

impl<T, S> Mul<&Matrix<T>> for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Matrix multiplication for a referenced matrix view and a referenced matrix

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Matrix<T>) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S> Mul<&Matrix<T>> for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Matrix multiplication for a matrix view and a referenced matrix

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &Matrix<T>) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S> Mul<&MatrixView<T, S>> for &Matrix<T>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Matrix multiplication for a referenced matrix and a referenced matrix view

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &MatrixView<T, S>) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S> Mul<&MatrixView<T, S>> for Matrix<T>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Matrix multiplication for a matrix and a referenced matrix view

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &MatrixView<T, S>) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S1, S2> Mul<&MatrixView<T, S2>> for &MatrixView<T, S1>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S1: MatrixRef<T> + NoInteriorMutability,
    S2: MatrixRef<T> + NoInteriorMutability,

Matrix multiplication for two referenced matrix views

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &MatrixView<T, S2>) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S1, S2> Mul<&MatrixView<T, S2>> for MatrixView<T, S1>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S1: MatrixRef<T> + NoInteriorMutability,
    S2: MatrixRef<T> + NoInteriorMutability,

Matrix multiplication for two matrix views with one referenced

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &MatrixView<T, S2>) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S> Mul<&T> for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix view and scalar by reference. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &T) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S> Mul<&T> for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix viiew by value and scalar by reference. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &T) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S> Mul<Matrix<T>> for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Matrix multiplication for a referenced matrix view and a matrix

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Matrix<T>) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S> Mul<Matrix<T>> for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Matrix multiplication for a matrix view and a matrix

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Matrix<T>) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S> Mul<MatrixView<T, S>> for &Matrix<T>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Matrix multiplication for a referenced matrix and a matrix view

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: MatrixView<T, S>) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S> Mul<MatrixView<T, S>> for Matrix<T>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Matrix multiplication for a matrix and a matrix view

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: MatrixView<T, S>) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S1, S2> Mul<MatrixView<T, S2>> for &MatrixView<T, S1>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S1: MatrixRef<T> + NoInteriorMutability,
    S2: MatrixRef<T> + NoInteriorMutability,

Matrix multiplication for two matrix views with one referenced

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: MatrixView<T, S2>) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S1, S2> Mul<MatrixView<T, S2>> for MatrixView<T, S1>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S1: MatrixRef<T> + NoInteriorMutability,
    S2: MatrixRef<T> + NoInteriorMutability,

Matrix multiplication for two matrix views

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: MatrixView<T, S2>) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S> Mul<T> for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix view by reference and scalar by value. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S> Mul<T> for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix view and scalar by value. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
source§

impl<T, S> Neg for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Elementwise negation for a referenced matrix view.

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<T, S> Neg for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Elementwise negation for a matrix view.

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<T, S> PartialEq<Matrix<T>> for MatrixView<T, S>where
    T: PartialEq,
    S: MatrixRef<T>,

A MatrixView and a Matrix can be compared for equality. PartialEq is implemented as they are equal if and only if all their elements are equal and they have the same size.

source§

fn eq(&self, other: &Matrix<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T, S> PartialEq<MatrixView<T, S>> for Matrix<T>where
    T: PartialEq,
    S: MatrixRef<T>,

A Matrix and a MatrixView can be compared for equality. PartialEq is implemented as they are equal if and only if all their elements are equal and they have the same size.

source§

fn eq(&self, other: &MatrixView<T, S>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T, S1, S2> PartialEq<MatrixView<T, S2>> for MatrixView<T, S1>where
    T: PartialEq,
    S1: MatrixRef<T>,
    S2: MatrixRef<T>,

PartialEq is implemented as two matrix views are equal if and only if all their elements are equal and they have the same size. Differences in their source types are ignored.

source§

fn eq(&self, other: &MatrixView<T, S2>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T, S> Sub<&Matrix<T>> for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise subtraction for a referenced matrix view and a referenced matrix

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &Matrix<T>) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S> Sub<&Matrix<T>> for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise subtraction for a matrix view and a referenced matrix

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &Matrix<T>) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S> Sub<&MatrixView<T, S>> for &Matrix<T>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise subtraction for a referenced matrix and a referenced matrix view

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &MatrixView<T, S>) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S> Sub<&MatrixView<T, S>> for Matrix<T>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise subtraction for a matrix and a referenced matrix view

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &MatrixView<T, S>) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S1, S2> Sub<&MatrixView<T, S2>> for &MatrixView<T, S1>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S1: MatrixRef<T> + NoInteriorMutability,
    S2: MatrixRef<T> + NoInteriorMutability,

Elementwise subtraction for two referenced matrix views

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &MatrixView<T, S2>) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S1, S2> Sub<&MatrixView<T, S2>> for MatrixView<T, S1>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S1: MatrixRef<T> + NoInteriorMutability,
    S2: MatrixRef<T> + NoInteriorMutability,

Elementwise addition for two matrix views with one referenced

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &MatrixView<T, S2>) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S> Sub<&T> for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix view and scalar by reference. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &T) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S> Sub<&T> for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix viiew by value and scalar by reference. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &T) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S> Sub<Matrix<T>> for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise subtraction for a referenced matrix view and a matrix

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Matrix<T>) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S> Sub<Matrix<T>> for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise subtraction for a matrix view and a matrix

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Matrix<T>) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S> Sub<MatrixView<T, S>> for &Matrix<T>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise subtraction for a referenced matrix and a matrix view

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: MatrixView<T, S>) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S> Sub<MatrixView<T, S>> for Matrix<T>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T> + NoInteriorMutability,

Elementwise subtraction for a matrix and a matrix view

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: MatrixView<T, S>) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S1, S2> Sub<MatrixView<T, S2>> for &MatrixView<T, S1>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S1: MatrixRef<T> + NoInteriorMutability,
    S2: MatrixRef<T> + NoInteriorMutability,

Elementwise subtraction for two matrix views with one referenced

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: MatrixView<T, S2>) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S1, S2> Sub<MatrixView<T, S2>> for MatrixView<T, S1>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S1: MatrixRef<T> + NoInteriorMutability,
    S2: MatrixRef<T> + NoInteriorMutability,

Elementwise subtraction for two matrix views

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: MatrixView<T, S2>) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S> Sub<T> for &MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix view by reference and scalar by value. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more
source§

impl<T, S> Sub<T> for MatrixView<T, S>where
    T: Numeric,
    for<'a> &'a T: NumericRef<T>,
    S: MatrixRef<T>,

Operation for a matrix view and scalar by value. The scalar is applied to all elements, this is a shorthand for map().

§

type Output = Matrix<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<T, S> RefUnwindSafe for MatrixView<T, S>where
    S: RefUnwindSafe,
    T: RefUnwindSafe,

§

impl<T, S> Send for MatrixView<T, S>where
    S: Send,
    T: Send,

§

impl<T, S> Sync for MatrixView<T, S>where
    S: Sync,
    T: Sync,

§

impl<T, S> Unpin for MatrixView<T, S>where
    S: Unpin,
    T: Unpin,

§

impl<T, S> UnwindSafe for MatrixView<T, S>where
    S: UnwindSafe,
    T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · 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> ToOwned for Twhere
    T: Clone,

§

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> ToString for Twhere
    T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T, Rhs, Output> NumericByValue<Rhs, Output> for Twhere
    T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Neg<Output = Output>,

source§

impl<RefT, T> NumericRef<T> for RefTwhere
    RefT: NumericByValue<T, T> + for<'a> NumericByValue<&'a T, T>,