Struct easy_ml::matrices::views::MatrixView
source · 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>,
impl<T, S> MatrixView<T, S>where
S: MatrixRef<T>,
MatrixView methods which require only read access via a MatrixRef source.
sourcepub fn from(source: S) -> MatrixView<T, S>
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.
sourcepub fn source_ref(&self) -> &S
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.
sourcepub fn source_ref_mut(&mut self) -> &mut S
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.
sourcepub fn size(&self) -> (Row, Column)
pub fn size(&self) -> (Row, Column)
Returns the dimensionality of this matrix view in Row, Column format
sourcepub fn data_layout(&self) -> DataLayout
pub fn data_layout(&self) -> DataLayout
Gets the data layout this MatrixView’s source uses to store its data.
sourcepub fn get_reference(&self, row: Row, column: Column) -> &T
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.
sourcepub fn try_get_reference(&self, row: Row, column: Column) -> Option<&T>
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.
sourcepub unsafe fn get_reference_unchecked(&self, row: Row, column: Column) -> &T
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.
sourcepub fn column_reference_iter(
&self,
column: Column
) -> ColumnReferenceIterator<'_, T, S> ⓘ
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.
sourcepub fn row_reference_iter(&self, row: Row) -> RowReferenceIterator<'_, T, S> ⓘ
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.
sourcepub fn column_major_reference_iter(
&self
) -> ColumnMajorReferenceIterator<'_, T, S> ⓘ
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.
sourcepub fn row_major_reference_iter(&self) -> RowMajorReferenceIterator<'_, T, S> ⓘ
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.
sourcepub fn diagonal_reference_iter(&self) -> DiagonalReferenceIterator<'_, T, S> ⓘ
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>,
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.
sourcepub fn get(&self, row: Row, column: Column) -> T
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.
sourcepub fn column_iter(&self, column: Column) -> ColumnIterator<'_, T, S> ⓘ
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.
sourcepub fn row_iter(&self, row: Row) -> RowIterator<'_, T, S> ⓘ
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.
sourcepub fn column_major_iter(&self) -> ColumnMajorIterator<'_, T, S> ⓘ
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.
sourcepub fn row_major_iter(&self) -> RowMajorIterator<'_, T, S> ⓘ
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.
sourcepub fn diagonal_iter(&self) -> DiagonalIterator<'_, T, S> ⓘ
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);
sourcepub fn map<U>(&self, mapping_function: impl Fn(T) -> U) -> Matrix<U>where
U: Clone,
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);
sourcepub fn map_with_index<U>(
&self,
mapping_function: impl Fn(T, Row, Column) -> U
) -> Matrix<U>where
U: Clone,
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>,
impl<T, S> MatrixView<T, S>where
S: MatrixMut<T>,
MatrixView methods which require mutable access via a MatrixMut source.
sourcepub fn get_reference_mut(&mut self, row: Row, column: Column) -> &mut T
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.
sourcepub fn set(&mut self, row: Row, column: Column, value: T)
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.
sourcepub fn try_get_reference_mut(
&mut self,
row: Row,
column: Column
) -> Option<&mut T>
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.
sourcepub unsafe fn get_reference_unchecked_mut(
&mut self,
row: Row,
column: Column
) -> &mut T
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,
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.
sourcepub fn column_reference_mut_iter(
&mut self,
column: Column
) -> ColumnReferenceMutIterator<'_, T, S> ⓘ
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.
sourcepub fn row_reference_mut_iter(
&mut self,
row: Row
) -> RowReferenceMutIterator<'_, T, S> ⓘ
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.
sourcepub fn column_major_reference_mut_iter(
&mut self
) -> ColumnMajorReferenceMutIterator<'_, T, S> ⓘ
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.
sourcepub fn row_major_reference_mut_iter(
&mut self
) -> RowMajorReferenceMutIterator<'_, T, S> ⓘ
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.
sourcepub fn diagonal_reference_mut_iter(
&mut self
) -> DiagonalReferenceMutIterator<'_, T, S> ⓘ
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>,
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.
sourcepub fn map_mut(&mut self, mapping_function: impl Fn(T) -> T)
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);
sourcepub fn map_mut_with_index(
&mut self,
mapping_function: impl Fn(T, Row, Column) -> T
)
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,
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
source§impl<T, S> Add<&Matrix<T>> for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Add<&MatrixView<T, S>> for &Matrix<T>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Add<&MatrixView<T, S>> for Matrix<T>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
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,
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
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,
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
source§impl<T, S> Add<&T> for &MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T, S> Add<&T> for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T, S> Add<Matrix<T>> for &MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Add<Matrix<T>> for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Add<MatrixView<T, S>> for &Matrix<T>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Add<MatrixView<T, S>> for Matrix<T>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
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,
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
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,
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
source§impl<T, S> Add<T> for &MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T, S> Add<T> for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T: Clone, S: Clone> Clone for MatrixView<T, S>
impl<T: Clone, S: Clone> Clone for MatrixView<T, S>
source§fn clone(&self) -> MatrixView<T, S>
fn clone(&self) -> MatrixView<T, S>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<T, S> Display for MatrixView<T, S>where
T: Display,
S: MatrixRef<T>,
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§impl<T, S> Div<&T> for &MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T, S> Div<&T> for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T, S> Div<T> for &MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T, S> Div<T> for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T, S> Mul<&Matrix<T>> for &MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Mul<&Matrix<T>> for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Mul<&MatrixView<T, S>> for &Matrix<T>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Mul<&MatrixView<T, S>> for Matrix<T>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
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,
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
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,
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
source§impl<T, S> Mul<&T> for &MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T, S> Mul<&T> for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T, S> Mul<Matrix<T>> for &MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Mul<Matrix<T>> for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Mul<MatrixView<T, S>> for &Matrix<T>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Mul<MatrixView<T, S>> for Matrix<T>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
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,
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
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,
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
source§impl<T, S> Mul<T> for &MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T, S> Mul<T> for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T, S> Neg for &MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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.
source§impl<T, S> Neg for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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.
source§impl<T, S> PartialEq<Matrix<T>> for MatrixView<T, S>where
T: PartialEq,
S: MatrixRef<T>,
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§impl<T, S> PartialEq<MatrixView<T, S>> for Matrix<T>where
T: PartialEq,
S: MatrixRef<T>,
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
fn eq(&self, other: &MatrixView<T, S>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<T, S1, S2> PartialEq<MatrixView<T, S2>> for MatrixView<T, S1>where
T: PartialEq,
S1: MatrixRef<T>,
S2: MatrixRef<T>,
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
fn eq(&self, other: &MatrixView<T, S2>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<T, S> Sub<&Matrix<T>> for &MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Sub<&Matrix<T>> for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Sub<&MatrixView<T, S>> for &Matrix<T>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Sub<&MatrixView<T, S>> for Matrix<T>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
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,
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
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,
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
source§impl<T, S> Sub<&T> for &MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T, S> Sub<&T> for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T, S> Sub<Matrix<T>> for &MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Sub<Matrix<T>> for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Sub<MatrixView<T, S>> for &Matrix<T>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
source§impl<T, S> Sub<MatrixView<T, S>> for Matrix<T>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T> + NoInteriorMutability,
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
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,
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
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,
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
source§impl<T, S> Sub<T> for &MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().
source§impl<T, S> Sub<T> for MatrixView<T, S>where
T: Numeric,
for<'a> &'a T: NumericRef<T>,
S: MatrixRef<T>,
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().