pub struct Matrix<M> { /* private fields */ }
Expand description
Generic matrix container.
Implementations§
Source§impl<I, E: Entity> Matrix<PermOwn<I, E>>
impl<I, E: Entity> Matrix<PermOwn<I, E>>
Sourcepub fn as_ref(&self) -> PermutationRef<'_, I, E>
pub fn as_ref(&self) -> PermutationRef<'_, I, E>
Convert self
to a permutation view.
Sourcepub fn as_mut(&mut self) -> PermutationMut<'_, I, E>
pub fn as_mut(&mut self) -> PermutationMut<'_, I, E>
Convert self
to a mutable permutation view.
Source§impl<I: Index, E: Entity> Matrix<PermOwn<I, E>>
impl<I: Index, E: Entity> Matrix<PermOwn<I, E>>
Sourcepub fn new_checked(forward: Box<[I]>, inverse: Box<[I]>) -> Self
pub fn new_checked(forward: Box<[I]>, inverse: Box<[I]>) -> Self
Creates a new permutation, by checking the validity of the inputs.
§Panics
The function panics if any of the following conditions are violated:
forward
and inverse
must have the same length which must be less than or equal to
I::Signed::MAX
, be valid permutations, and be inverse permutations of each other.
Sourcepub unsafe fn new_unchecked(forward: Box<[I]>, inverse: Box<[I]>) -> Self
pub unsafe fn new_unchecked(forward: Box<[I]>, inverse: Box<[I]>) -> Self
Creates a new permutation reference, without checking the validity of the inputs.
§Safety
forward
and inverse
must have the same length which must be less than or equal to
I::Signed::MAX
, be valid permutations, and be inverse permutations of each other.
Sourcepub fn cast<T: Entity>(self) -> Permutation<I, T>
pub fn cast<T: Entity>(self) -> Permutation<I, T>
Cast the permutation to a different scalar type.
Source§impl<'a, I: Index, E: Entity> Matrix<PermRef<'a, I, E>>
impl<'a, I: Index, E: Entity> Matrix<PermRef<'a, I, E>>
Sourcepub fn new_checked(forward: &'a [I], inverse: &'a [I]) -> Self
pub fn new_checked(forward: &'a [I], inverse: &'a [I]) -> Self
Creates a new permutation reference, by checking the validity of the inputs.
§Panics
The function panics if any of the following conditions are violated:
forward
and inverse
must have the same length which must be less than or equal to
I::Signed::MAX
, be valid permutations, and be inverse permutations of each other.
Sourcepub unsafe fn new_unchecked(forward: &'a [I], inverse: &'a [I]) -> Self
pub unsafe fn new_unchecked(forward: &'a [I], inverse: &'a [I]) -> Self
Creates a new permutation reference, without checking the validity of the inputs.
§Safety
forward
and inverse
must have the same length which must be less than or equal to
I::Signed::MAX
, be valid permutations, and be inverse permutations of each other.
Sourcepub fn into_arrays(self) -> (&'a [I], &'a [I])
pub fn into_arrays(self) -> (&'a [I], &'a [I])
Returns the permutation as an array.
Sourcepub fn cast<T: Entity>(self) -> PermutationRef<'a, I, T>
pub fn cast<T: Entity>(self) -> PermutationRef<'a, I, T>
Cast the permutation to a different scalar type.
Sourcepub fn canonicalize(self) -> PermutationRef<'a, I::FixedWidth, E>
pub fn canonicalize(self) -> PermutationRef<'a, I::FixedWidth, E>
Cast the permutation to the fixed width index type.
Sourcepub fn uncanonicalize<J: Index>(self) -> PermutationRef<'a, J, E>
pub fn uncanonicalize<J: Index>(self) -> PermutationRef<'a, J, E>
Cast the permutation from the fixed width index type.
Source§impl<'a, I: Index, E: Entity> Matrix<PermMut<'a, I, E>>
impl<'a, I: Index, E: Entity> Matrix<PermMut<'a, I, E>>
Sourcepub fn new_checked(forward: &'a mut [I], inverse: &'a mut [I]) -> Self
pub fn new_checked(forward: &'a mut [I], inverse: &'a mut [I]) -> Self
Creates a new permutation mutable reference, by checking the validity of the inputs.
§Panics
The function panics if any of the following conditions are violated:
forward
and inverse
must have the same length which must be less than or equal to
I::Signed::MAX
, be valid permutations, and be inverse permutations of each other.
Sourcepub unsafe fn new_unchecked(forward: &'a mut [I], inverse: &'a mut [I]) -> Self
pub unsafe fn new_unchecked(forward: &'a mut [I], inverse: &'a mut [I]) -> Self
Creates a new permutation mutable reference, without checking the validity of the inputs.
§Safety
forward
and inverse
must have the same length which must be less than or equal to
I::Signed::MAX
, be valid permutations, and be inverse permutations of each other.
Sourcepub unsafe fn into_arrays(self) -> (&'a mut [I], &'a mut [I])
pub unsafe fn into_arrays(self) -> (&'a mut [I], &'a mut [I])
Returns the permutation as an array.
§Safety
The behavior is undefined if the arrays are no longer inverse permutations of each other by
the end of lifetime 'a
.
Sourcepub fn cast<T: Entity>(self) -> PermutationMut<'a, I, T>
pub fn cast<T: Entity>(self) -> PermutationMut<'a, I, T>
Cast the permutation to a different scalar type.
Sourcepub fn canonicalize(self) -> PermutationMut<'a, I::FixedWidth, E>
pub fn canonicalize(self) -> PermutationMut<'a, I::FixedWidth, E>
Cast the permutation to the fixed width index type.
Sourcepub fn uncanonicalize<J: Index>(self) -> PermutationMut<'a, J, E>
pub fn uncanonicalize<J: Index>(self) -> PermutationMut<'a, J, E>
Cast the permutation from the fixed width index type.
Source§impl<'a, I: Index, E: Entity> Matrix<SparseRowMatMut<'a, I, E>>
impl<'a, I: Index, E: Entity> Matrix<SparseRowMatMut<'a, I, E>>
Sourcepub fn new(
symbolic: SymbolicSparseRowMatRef<'a, I>,
values: GroupFor<E, &'a mut [E::Unit]>,
) -> Self
pub fn new( symbolic: SymbolicSparseRowMatRef<'a, I>, values: GroupFor<E, &'a mut [E::Unit]>, ) -> Self
Creates a new sparse matrix view.
§Panics
Panics if the length of values
is not equal to the length of
symbolic.col_indices()
.
Sourcepub fn to_owned(&self) -> Result<SparseRowMat<I, E::Canonical>, FaerError>
pub fn to_owned(&self) -> Result<SparseRowMat<I, E::Canonical>, FaerError>
Copies the current matrix into a newly allocated matrix.
§Note
Allows unsorted matrices, producing an unsorted output.
Sourcepub fn to_col_major(&self) -> Result<SparseColMat<I, E::Canonical>, FaerError>
pub fn to_col_major(&self) -> Result<SparseColMat<I, E::Canonical>, FaerError>
Copies the current matrix into a newly allocated matrix, with column-major order.
§Note
Allows unsorted matrices, producing a sorted output. Duplicate entries are kept, however.
Sourcepub fn transpose_mut(self) -> SparseColMatMut<'a, I, E>
pub fn transpose_mut(self) -> SparseColMatMut<'a, I, E>
Returns a view over the transpose of self
in column-major format.
Sourcepub fn canonicalize_mut(self) -> (SparseRowMatMut<'a, I, E::Canonical>, Conj)where
E: Conjugate,
pub fn canonicalize_mut(self) -> (SparseRowMatMut<'a, I, E::Canonical>, Conj)where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn conjugate_mut(self) -> SparseRowMatMut<'a, I, E::Conj>where
E: Conjugate,
pub fn conjugate_mut(self) -> SparseRowMatMut<'a, I, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn adjoint_mut(self) -> SparseColMatMut<'a, I, E::Conj>where
E: Conjugate,
pub fn adjoint_mut(self) -> SparseColMatMut<'a, I, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Sourcepub fn values_mut(self) -> GroupFor<E, &'a mut [E::Unit]>
pub fn values_mut(self) -> GroupFor<E, &'a mut [E::Unit]>
Returns the numerical values of the matrix.
Sourcepub fn values_of_row_mut(self, i: usize) -> GroupFor<E, &'a mut [E::Unit]>
pub fn values_of_row_mut(self, i: usize) -> GroupFor<E, &'a mut [E::Unit]>
Sourcepub fn symbolic(&self) -> SymbolicSparseRowMatRef<'a, I>
pub fn symbolic(&self) -> SymbolicSparseRowMatRef<'a, I>
Returns the symbolic structure of the matrix.
Sourcepub fn into_parts(
self,
) -> (SymbolicSparseRowMatRef<'a, I>, GroupFor<E, &'a mut [E::Unit]>)
pub fn into_parts( self, ) -> (SymbolicSparseRowMatRef<'a, I>, GroupFor<E, &'a mut [E::Unit]>)
Decomposes the matrix into the symbolic part and the numerical values.
Source§impl<'a, I: Index, E: Entity> Matrix<SparseColMatMut<'a, I, E>>
impl<'a, I: Index, E: Entity> Matrix<SparseColMatMut<'a, I, E>>
Sourcepub fn new(
symbolic: SymbolicSparseColMatRef<'a, I>,
values: GroupFor<E, &'a mut [E::Unit]>,
) -> Self
pub fn new( symbolic: SymbolicSparseColMatRef<'a, I>, values: GroupFor<E, &'a mut [E::Unit]>, ) -> Self
Creates a new sparse matrix view.
§Panics
Panics if the length of values
is not equal to the length of
symbolic.row_indices()
.
Sourcepub fn to_owned(&self) -> Result<SparseColMat<I, E::Canonical>, FaerError>
pub fn to_owned(&self) -> Result<SparseColMat<I, E::Canonical>, FaerError>
Copies the current matrix into a newly allocated matrix.
§Note
Allows unsorted matrices, producing an unsorted output.
Sourcepub fn to_row_major(&self) -> Result<SparseRowMat<I, E::Canonical>, FaerError>
pub fn to_row_major(&self) -> Result<SparseRowMat<I, E::Canonical>, FaerError>
Copies the current matrix into a newly allocated matrix, with row-major order.
§Note
Allows unsorted matrices, producing a sorted output. Duplicate entries are kept, however.
Sourcepub fn transpose_mut(self) -> SparseRowMatMut<'a, I, E>
pub fn transpose_mut(self) -> SparseRowMatMut<'a, I, E>
Returns a view over the transpose of self
in row-major format.
Sourcepub fn conjugate_mut(self) -> SparseColMatMut<'a, I, E::Conj>where
E: Conjugate,
pub fn conjugate_mut(self) -> SparseColMatMut<'a, I, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn canonicalize_mut(self) -> (SparseColMatMut<'a, I, E::Canonical>, Conj)where
E: Conjugate,
pub fn canonicalize_mut(self) -> (SparseColMatMut<'a, I, E::Canonical>, Conj)where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn adjoint_mut(self) -> SparseRowMatMut<'a, I, E::Conj>where
E: Conjugate,
pub fn adjoint_mut(self) -> SparseRowMatMut<'a, I, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Sourcepub fn values_mut(self) -> GroupFor<E, &'a mut [E::Unit]>
pub fn values_mut(self) -> GroupFor<E, &'a mut [E::Unit]>
Returns the numerical values of the matrix.
Sourcepub fn values_of_col_mut(self, j: usize) -> GroupFor<E, &'a mut [E::Unit]>
pub fn values_of_col_mut(self, j: usize) -> GroupFor<E, &'a mut [E::Unit]>
Sourcepub fn symbolic(&self) -> SymbolicSparseColMatRef<'a, I>
pub fn symbolic(&self) -> SymbolicSparseColMatRef<'a, I>
Returns the symbolic structure of the matrix.
Sourcepub fn into_parts_mut(
self,
) -> (SymbolicSparseColMatRef<'a, I>, GroupFor<E, &'a mut [E::Unit]>)
pub fn into_parts_mut( self, ) -> (SymbolicSparseColMatRef<'a, I>, GroupFor<E, &'a mut [E::Unit]>)
Decomposes the matrix into the symbolic part and the numerical values.
Source§impl<'a, I: Index, E: Entity> Matrix<SparseRowMatRef<'a, I, E>>
impl<'a, I: Index, E: Entity> Matrix<SparseRowMatRef<'a, I, E>>
Sourcepub fn new(
symbolic: SymbolicSparseRowMatRef<'a, I>,
values: GroupFor<E, &'a [E::Unit]>,
) -> Self
pub fn new( symbolic: SymbolicSparseRowMatRef<'a, I>, values: GroupFor<E, &'a [E::Unit]>, ) -> Self
Creates a new sparse matrix view.
§Panics
Panics if the length of values
is not equal to the length of
symbolic.col_indices()
.
Sourcepub fn to_owned(&self) -> Result<SparseRowMat<I, E::Canonical>, FaerError>
pub fn to_owned(&self) -> Result<SparseRowMat<I, E::Canonical>, FaerError>
Copies the current matrix into a newly allocated matrix.
§Note
Allows unsorted matrices, producing an unsorted output.
Sourcepub fn to_col_major(&self) -> Result<SparseColMat<I, E::Canonical>, FaerError>
pub fn to_col_major(&self) -> Result<SparseColMat<I, E::Canonical>, FaerError>
Copies the current matrix into a newly allocated matrix, with column-major order.
§Note
Allows unsorted matrices, producing a sorted output. Duplicate entries are kept, however.
Sourcepub fn transpose(self) -> SparseColMatRef<'a, I, E>
pub fn transpose(self) -> SparseColMatRef<'a, I, E>
Returns a view over the transpose of self
in column-major format.
Sourcepub fn conjugate(self) -> SparseRowMatRef<'a, I, E::Conj>where
E: Conjugate,
pub fn conjugate(self) -> SparseRowMatRef<'a, I, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn canonicalize(self) -> (SparseRowMatRef<'a, I, E::Canonical>, Conj)where
E: Conjugate,
pub fn canonicalize(self) -> (SparseRowMatRef<'a, I, E::Canonical>, Conj)where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn adjoint(self) -> SparseColMatRef<'a, I, E::Conj>where
E: Conjugate,
pub fn adjoint(self) -> SparseColMatRef<'a, I, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Sourcepub fn values_of_row(self, i: usize) -> GroupFor<E, &'a [E::Unit]>
pub fn values_of_row(self, i: usize) -> GroupFor<E, &'a [E::Unit]>
Sourcepub fn symbolic(&self) -> SymbolicSparseRowMatRef<'a, I>
pub fn symbolic(&self) -> SymbolicSparseRowMatRef<'a, I>
Returns the symbolic structure of the matrix.
Sourcepub fn into_parts(
self,
) -> (SymbolicSparseRowMatRef<'a, I>, GroupFor<E, &'a [E::Unit]>)
pub fn into_parts( self, ) -> (SymbolicSparseRowMatRef<'a, I>, GroupFor<E, &'a [E::Unit]>)
Decomposes the matrix into the symbolic part and the numerical values.
Source§impl<'a, I: Index, E: Entity> Matrix<SparseColMatRef<'a, I, E>>
impl<'a, I: Index, E: Entity> Matrix<SparseColMatRef<'a, I, E>>
Sourcepub fn new(
symbolic: SymbolicSparseColMatRef<'a, I>,
values: GroupFor<E, &'a [E::Unit]>,
) -> Self
pub fn new( symbolic: SymbolicSparseColMatRef<'a, I>, values: GroupFor<E, &'a [E::Unit]>, ) -> Self
Creates a new sparse matrix view.
§Panics
Panics if the length of values
is not equal to the length of
symbolic.row_indices()
.
Sourcepub fn to_owned(&self) -> Result<SparseColMat<I, E::Canonical>, FaerError>
pub fn to_owned(&self) -> Result<SparseColMat<I, E::Canonical>, FaerError>
Copies the current matrix into a newly allocated matrix.
§Note
Allows unsorted matrices, producing an unsorted output.
Sourcepub fn to_row_major(&self) -> Result<SparseRowMat<I, E::Canonical>, FaerError>
pub fn to_row_major(&self) -> Result<SparseRowMat<I, E::Canonical>, FaerError>
Copies the current matrix into a newly allocated matrix, with row-major order.
§Note
Allows unsorted matrices, producing a sorted output. Duplicate entries are kept, however.
Sourcepub fn transpose(self) -> SparseRowMatRef<'a, I, E>
pub fn transpose(self) -> SparseRowMatRef<'a, I, E>
Returns a view over the transpose of self
in row-major format.
Sourcepub fn conjugate(self) -> SparseColMatRef<'a, I, E::Conj>where
E: Conjugate,
pub fn conjugate(self) -> SparseColMatRef<'a, I, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn canonicalize(self) -> (SparseColMatRef<'a, I, E::Canonical>, Conj)where
E: Conjugate,
pub fn canonicalize(self) -> (SparseColMatRef<'a, I, E::Canonical>, Conj)where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn adjoint(self) -> SparseRowMatRef<'a, I, E::Conj>where
E: Conjugate,
pub fn adjoint(self) -> SparseRowMatRef<'a, I, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Sourcepub fn values_of_col(self, j: usize) -> GroupFor<E, &'a [E::Unit]>
pub fn values_of_col(self, j: usize) -> GroupFor<E, &'a [E::Unit]>
Sourcepub fn symbolic(&self) -> SymbolicSparseColMatRef<'a, I>
pub fn symbolic(&self) -> SymbolicSparseColMatRef<'a, I>
Returns the symbolic structure of the matrix.
Sourcepub fn into_parts(
self,
) -> (SymbolicSparseColMatRef<'a, I>, GroupFor<E, &'a [E::Unit]>)
pub fn into_parts( self, ) -> (SymbolicSparseColMatRef<'a, I>, GroupFor<E, &'a [E::Unit]>)
Decomposes the matrix into the symbolic part and the numerical values.
Source§impl<I: Index, E: Entity> Matrix<SparseColMat<I, E>>
impl<I: Index, E: Entity> Matrix<SparseColMat<I, E>>
Sourcepub fn new(
symbolic: SymbolicSparseColMat<I>,
values: GroupFor<E, Vec<E::Unit>>,
) -> Self
pub fn new( symbolic: SymbolicSparseColMat<I>, values: GroupFor<E, Vec<E::Unit>>, ) -> Self
Creates a new sparse matrix view.
§Panics
Panics if the length of values
is not equal to the length of
symbolic.row_indices()
.
Sourcepub fn to_owned(&self) -> Result<SparseColMat<I, E::Canonical>, FaerError>
pub fn to_owned(&self) -> Result<SparseColMat<I, E::Canonical>, FaerError>
Copies the current matrix into a newly allocated matrix.
§Note
Allows unsorted matrices, producing an unsorted output.
Sourcepub fn to_row_major(&self) -> Result<SparseRowMat<I, E::Canonical>, FaerError>
pub fn to_row_major(&self) -> Result<SparseRowMat<I, E::Canonical>, FaerError>
Copies the current matrix into a newly allocated matrix, with row-major order.
§Note
Allows unsorted matrices, producing a sorted output. Duplicate entries are kept, however.
Sourcepub fn into_parts(self) -> (SymbolicSparseColMat<I>, GroupFor<E, Vec<E::Unit>>)
pub fn into_parts(self) -> (SymbolicSparseColMat<I>, GroupFor<E, Vec<E::Unit>>)
Decomposes the matrix into the symbolic part and the numerical values.
Sourcepub fn as_ref(&self) -> SparseColMatRef<'_, I, E>
pub fn as_ref(&self) -> SparseColMatRef<'_, I, E>
Returns a view over self
.
Sourcepub fn as_mut(&mut self) -> SparseColMatMut<'_, I, E>
pub fn as_mut(&mut self) -> SparseColMatMut<'_, I, E>
Returns a mutable view over self
.
Note that the symbolic structure cannot be changed through this view.
Sourcepub fn values(&self) -> GroupFor<E, &[E::Unit]>
pub fn values(&self) -> GroupFor<E, &[E::Unit]>
Returns a slice over the numerical values of the matrix.
Sourcepub fn values_mut(&mut self) -> GroupFor<E, &mut [E::Unit]>
pub fn values_mut(&mut self) -> GroupFor<E, &mut [E::Unit]>
Returns a mutable slice over the numerical values of the matrix.
Sourcepub fn into_transpose(self) -> SparseRowMat<I, E>
pub fn into_transpose(self) -> SparseRowMat<I, E>
Returns a view over the transpose of self
in row-major format.
§Note
Allows unsorted matrices, producing an unsorted output.
Sourcepub fn into_conjugate(self) -> SparseColMat<I, E::Conj>where
E: Conjugate,
pub fn into_conjugate(self) -> SparseColMat<I, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn into_adjoint(self) -> SparseRowMat<I, E::Conj>where
E: Conjugate,
pub fn into_adjoint(self) -> SparseRowMat<I, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Source§impl<I: Index, E: Entity> Matrix<SparseRowMat<I, E>>
impl<I: Index, E: Entity> Matrix<SparseRowMat<I, E>>
Sourcepub fn new(
symbolic: SymbolicSparseRowMat<I>,
values: GroupFor<E, Vec<E::Unit>>,
) -> Self
pub fn new( symbolic: SymbolicSparseRowMat<I>, values: GroupFor<E, Vec<E::Unit>>, ) -> Self
Creates a new sparse matrix view.
§Panics
Panics if the length of values
is not equal to the length of
symbolic.col_indices()
.
Sourcepub fn to_owned(&self) -> Result<SparseRowMat<I, E::Canonical>, FaerError>
pub fn to_owned(&self) -> Result<SparseRowMat<I, E::Canonical>, FaerError>
Copies the current matrix into a newly allocated matrix.
§Note
Allows unsorted matrices, producing an unsorted output.
Sourcepub fn to_col_major(&self) -> Result<SparseColMat<I, E::Canonical>, FaerError>
pub fn to_col_major(&self) -> Result<SparseColMat<I, E::Canonical>, FaerError>
Copies the current matrix into a newly allocated matrix, with column-major order.
§Note
Allows unsorted matrices, producing a sorted output. Duplicate entries are kept, however.
Sourcepub fn into_parts(self) -> (SymbolicSparseRowMat<I>, GroupFor<E, Vec<E::Unit>>)
pub fn into_parts(self) -> (SymbolicSparseRowMat<I>, GroupFor<E, Vec<E::Unit>>)
Decomposes the matrix into the symbolic part and the numerical values.
Sourcepub fn as_ref(&self) -> SparseRowMatRef<'_, I, E>
pub fn as_ref(&self) -> SparseRowMatRef<'_, I, E>
Returns a view over self
.
Sourcepub fn as_mut(&mut self) -> SparseRowMatMut<'_, I, E>
pub fn as_mut(&mut self) -> SparseRowMatMut<'_, I, E>
Returns a mutable view over self
.
Note that the symbolic structure cannot be changed through this view.
Sourcepub fn values(&self) -> GroupFor<E, &[E::Unit]>
pub fn values(&self) -> GroupFor<E, &[E::Unit]>
Returns a slice over the numerical values of the matrix.
Sourcepub fn values_mut(&mut self) -> GroupFor<E, &mut [E::Unit]>
pub fn values_mut(&mut self) -> GroupFor<E, &mut [E::Unit]>
Returns a mutable slice over the numerical values of the matrix.
Sourcepub fn into_transpose(self) -> SparseColMat<I, E>
pub fn into_transpose(self) -> SparseColMat<I, E>
Returns a view over the transpose of self
in column-major format.
§Note
Allows unsorted matrices, producing an unsorted output.
Sourcepub fn into_conjugate(self) -> SparseRowMat<I, E::Conj>where
E: Conjugate,
pub fn into_conjugate(self) -> SparseRowMat<I, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn into_adjoint(self) -> SparseColMat<I, E::Conj>where
E: Conjugate,
pub fn into_adjoint(self) -> SparseColMat<I, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Source§impl<I: Index, E: ComplexField> Matrix<SparseColMat<I, E>>
impl<I: Index, E: ComplexField> Matrix<SparseColMat<I, E>>
Sourcepub fn new_from_order_and_values(
symbolic: SymbolicSparseColMat<I>,
order: &ValuesOrder<I>,
values: GroupFor<E, &[E::Unit]>,
) -> Result<Self, FaerError>
pub fn new_from_order_and_values( symbolic: SymbolicSparseColMat<I>, order: &ValuesOrder<I>, values: GroupFor<E, &[E::Unit]>, ) -> Result<Self, FaerError>
Create a new matrix from a previously created symbolic structure and value order. The provided values must correspond to the same indices that were provided in the function call from which the order was created.
Sourcepub fn try_new_from_triplets(
nrows: usize,
ncols: usize,
triplets: &[(I, I, E)],
) -> Result<Self, CreationError>
pub fn try_new_from_triplets( nrows: usize, ncols: usize, triplets: &[(I, I, E)], ) -> Result<Self, CreationError>
Create a new matrix from triplets (row, col, value)
.
Sourcepub fn try_new_from_nonnegative_triplets(
nrows: usize,
ncols: usize,
triplets: &[(I::Signed, I::Signed, E)],
) -> Result<Self, CreationError>
pub fn try_new_from_nonnegative_triplets( nrows: usize, ncols: usize, triplets: &[(I::Signed, I::Signed, E)], ) -> Result<Self, CreationError>
Create a new matrix from triplets (row, col, value)
. Negative indices are ignored.
Source§impl<I: Index, E: ComplexField> Matrix<SparseRowMat<I, E>>
impl<I: Index, E: ComplexField> Matrix<SparseRowMat<I, E>>
Sourcepub fn new_from_order_and_values(
symbolic: SymbolicSparseRowMat<I>,
order: &ValuesOrder<I>,
values: GroupFor<E, &[E::Unit]>,
) -> Result<Self, FaerError>
pub fn new_from_order_and_values( symbolic: SymbolicSparseRowMat<I>, order: &ValuesOrder<I>, values: GroupFor<E, &[E::Unit]>, ) -> Result<Self, FaerError>
Create a new matrix from a previously created symbolic structure and value order. The provided values must correspond to the same indices that were provided in the function call from which the order was created.
Sourcepub fn try_new_from_triplets(
nrows: usize,
ncols: usize,
triplets: &[(I, I, E)],
) -> Result<Self, CreationError>
pub fn try_new_from_triplets( nrows: usize, ncols: usize, triplets: &[(I, I, E)], ) -> Result<Self, CreationError>
Create a new matrix from triplets (row, col, value)
.
Sourcepub fn try_new_from_nonnegative_triplets(
nrows: usize,
ncols: usize,
triplets: &[(I::Signed, I::Signed, E)],
) -> Result<Self, CreationError>
pub fn try_new_from_nonnegative_triplets( nrows: usize, ncols: usize, triplets: &[(I::Signed, I::Signed, E)], ) -> Result<Self, CreationError>
Create a new matrix from triplets (row, col, value)
. Negative indices are ignored.
Source§impl<I: Index, E: ComplexField> Matrix<SparseColMatMut<'_, I, E>>
impl<I: Index, E: ComplexField> Matrix<SparseColMatMut<'_, I, E>>
Sourcepub fn fill_from_order_and_values(
&mut self,
order: &ValuesOrder<I>,
values: GroupFor<E, &[E::Unit]>,
mode: FillMode,
)
pub fn fill_from_order_and_values( &mut self, order: &ValuesOrder<I>, values: GroupFor<E, &[E::Unit]>, mode: FillMode, )
Fill the matrix from a previously created value order. The provided values must correspond to the same indices that were provided in the function call from which the order was created.
§Note
The symbolic structure is not changed.
Source§impl<I: Index, E: ComplexField> Matrix<SparseRowMatMut<'_, I, E>>
impl<I: Index, E: ComplexField> Matrix<SparseRowMatMut<'_, I, E>>
Sourcepub fn fill_from_order_and_values(
&mut self,
order: &ValuesOrder<I>,
values: GroupFor<E, &[E::Unit]>,
mode: FillMode,
)
pub fn fill_from_order_and_values( &mut self, order: &ValuesOrder<I>, values: GroupFor<E, &[E::Unit]>, mode: FillMode, )
Fill the matrix from a previously created value order. The provided values must correspond to the same indices that were provided in the function call from which the order was created.
§Note
The symbolic structure is not changed.
Source§impl<'a, I: Index, E: Entity> Matrix<SparseColMatMut<'a, I, E>>
impl<'a, I: Index, E: Entity> Matrix<SparseColMatMut<'a, I, E>>
Source§impl<I: Index, E: Entity> Matrix<SparseColMat<I, E>>
impl<I: Index, E: Entity> Matrix<SparseColMat<I, E>>
Source§impl<I: Index, E: Entity> Matrix<SparseRowMat<I, E>>
impl<I: Index, E: Entity> Matrix<SparseRowMat<I, E>>
Source§impl<'a, E: Entity> Matrix<DiagRef<'a, E>>
impl<'a, E: Entity> Matrix<DiagRef<'a, E>>
Sourcepub fn column_vector(self) -> ColRef<'a, E>
pub fn column_vector(self) -> ColRef<'a, E>
Returns the diagonal as a column vector view.
Source§impl<'a, E: Entity> Matrix<DiagMut<'a, E>>
impl<'a, E: Entity> Matrix<DiagMut<'a, E>>
Sourcepub fn column_vector_mut(self) -> ColMut<'a, E>
pub fn column_vector_mut(self) -> ColMut<'a, E>
Returns the diagonal as a mutable column vector view.
Source§impl<'a, E: Entity> Matrix<DenseColRef<'a, E>>
impl<'a, E: Entity> Matrix<DenseColRef<'a, E>>
Sourcepub fn ncols(&self) -> usize
pub fn ncols(&self) -> usize
Returns the number of columns of the column. This is always equal to 1
.
Sourcepub fn row_stride(&self) -> isize
pub fn row_stride(&self) -> isize
Returns the row stride of the matrix, specified in number of elements, not in bytes.
Sourcepub fn ptr_at(self, row: usize) -> GroupFor<E, *const E::Unit>
pub fn ptr_at(self, row: usize) -> GroupFor<E, *const E::Unit>
Returns raw pointers to the element at the given index.
Sourcepub unsafe fn ptr_inbounds_at(self, row: usize) -> GroupFor<E, *const E::Unit>
pub unsafe fn ptr_inbounds_at(self, row: usize) -> GroupFor<E, *const E::Unit>
Returns raw pointers to the element at the given index, assuming the provided index is within the size of the vector.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.
Sourcepub unsafe fn split_at_unchecked(self, row: usize) -> (Self, Self)
pub unsafe fn split_at_unchecked(self, row: usize) -> (Self, Self)
Splits the column vector at the given index into two parts and returns an array of each subvector, in the following order:
- top.
- bottom.
§Safety
The behavior is undefined if any of the following conditions are violated:
row <= self.nrows()
.
Sourcepub unsafe fn split_at(self, row: usize) -> (Self, Self)
pub unsafe fn split_at(self, row: usize) -> (Self, Self)
Splits the column vector at the given index into two parts and returns an array of each subvector, in the following order:
- top.
- bottom.
§Panics
The function panics if any of the following conditions are violated:
row <= self.nrows()
.
Sourcepub unsafe fn get_unchecked<RowRange>(
self,
row: RowRange,
) -> <Self as ColIndex<RowRange>>::Targetwhere
Self: ColIndex<RowRange>,
pub unsafe fn get_unchecked<RowRange>(
self,
row: RowRange,
) -> <Self as ColIndex<RowRange>>::Targetwhere
Self: ColIndex<RowRange>,
Returns references to the element at the given index, or subvector if row
is a
range.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Safety
The behavior is undefined if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.
Sourcepub fn get<RowRange>(
self,
row: RowRange,
) -> <Self as ColIndex<RowRange>>::Targetwhere
Self: ColIndex<RowRange>,
pub fn get<RowRange>(
self,
row: RowRange,
) -> <Self as ColIndex<RowRange>>::Targetwhere
Self: ColIndex<RowRange>,
Returns references to the element at the given index, or subvector if row
is a
range, with bound checks.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Panics
The function panics if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.
Sourcepub unsafe fn read_unchecked(&self, row: usize) -> E
pub unsafe fn read_unchecked(&self, row: usize) -> E
Reads the value of the element at the given index.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.
Sourcepub fn read(&self, row: usize) -> E
pub fn read(&self, row: usize) -> E
Reads the value of the element at the given index, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
row < self.nrows()
.
Sourcepub fn conjugate(self) -> ColRef<'a, E::Conj>where
E: Conjugate,
pub fn conjugate(self) -> ColRef<'a, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn adjoint(self) -> RowRef<'a, E::Conj>where
E: Conjugate,
pub fn adjoint(self) -> RowRef<'a, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Sourcepub fn canonicalize(self) -> (ColRef<'a, E::Canonical>, Conj)where
E: Conjugate,
pub fn canonicalize(self) -> (ColRef<'a, E::Canonical>, Conj)where
E: Conjugate,
Returns a view over the canonical representation of self
, as well as a flag declaring
whether self
is implicitly conjugated or not.
Sourcepub fn reverse_rows(self) -> Self
pub fn reverse_rows(self) -> Self
Returns a view over the self
, with the rows in reversed order.
Sourcepub unsafe fn subrows_unchecked(self, row_start: usize, nrows: usize) -> Self
pub unsafe fn subrows_unchecked(self, row_start: usize, nrows: usize) -> Self
Returns a view over the subvector starting at row row_start
, and with number of rows
nrows
.
§Safety
The behavior is undefined if any of the following conditions are violated:
row_start <= self.nrows()
.nrows <= self.nrows() - row_start
.
Sourcepub fn subrows(self, row_start: usize, nrows: usize) -> Self
pub fn subrows(self, row_start: usize, nrows: usize) -> Self
Returns a view over the subvector starting at row row_start
, and with number of rows
nrows
.
§Safety
The behavior is undefined if any of the following conditions are violated:
row_start <= self.nrows()
.nrows <= self.nrows() - row_start
.
Sourcepub fn column_vector_as_diagonal(self) -> Matrix<DiagRef<'a, E>>
pub fn column_vector_as_diagonal(self) -> Matrix<DiagRef<'a, E>>
Given a matrix with a single column, returns an object that interprets the column as a diagonal matrix, whoes diagonal elements are values in the column.
Sourcepub fn to_owned(&self) -> Col<E::Canonical>where
E: Conjugate,
pub fn to_owned(&self) -> Col<E::Canonical>where
E: Conjugate,
Returns an owning Col
of the data.
Sourcepub fn has_nan(&self) -> boolwhere
E: ComplexField,
pub fn has_nan(&self) -> boolwhere
E: ComplexField,
Returns true
if any of the elements is NaN, otherwise returns false
.
Sourcepub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
pub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
Returns true
if all of the elements are finite, otherwise returns false
.
Sourcepub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
Returns the maximum norm of self
.
Sourcepub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
Returns the L2 norm of self
.
Sourcepub fn sum(&self) -> Ewhere
E: ComplexField,
pub fn sum(&self) -> Ewhere
E: ComplexField,
Returns the sum of self
.
Source§impl<'a, E: Entity> Matrix<DenseColMut<'a, E>>
impl<'a, E: Entity> Matrix<DenseColMut<'a, E>>
Sourcepub fn ncols(&self) -> usize
pub fn ncols(&self) -> usize
Returns the number of columns of the column. This is always equal to 1
.
Sourcepub fn as_ptr_mut(self) -> GroupFor<E, *mut E::Unit>
pub fn as_ptr_mut(self) -> GroupFor<E, *mut E::Unit>
Returns pointers to the matrix data.
Sourcepub fn row_stride(&self) -> isize
pub fn row_stride(&self) -> isize
Returns the row stride of the matrix, specified in number of elements, not in bytes.
Sourcepub fn ptr_at_mut(self, row: usize) -> GroupFor<E, *mut E::Unit>
pub fn ptr_at_mut(self, row: usize) -> GroupFor<E, *mut E::Unit>
Returns raw pointers to the element at the given index.
Sourcepub unsafe fn ptr_inbounds_at_mut(self, row: usize) -> GroupFor<E, *mut E::Unit>
pub unsafe fn ptr_inbounds_at_mut(self, row: usize) -> GroupFor<E, *mut E::Unit>
Returns raw pointers to the element at the given index, assuming the provided index is within the size of the vector.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.
Sourcepub unsafe fn split_at_mut_unchecked(self, row: usize) -> (Self, Self)
pub unsafe fn split_at_mut_unchecked(self, row: usize) -> (Self, Self)
Splits the column vector at the given index into two parts and returns an array of each subvector, in the following order:
- top.
- bottom.
§Safety
The behavior is undefined if any of the following conditions are violated:
row <= self.nrows()
.
Sourcepub fn split_at_mut(self, row: usize) -> (Self, Self)
pub fn split_at_mut(self, row: usize) -> (Self, Self)
Splits the column vector at the given index into two parts and returns an array of each subvector, in the following order:
- top.
- bottom.
§Panics
The function panics if any of the following conditions are violated:
row <= self.nrows()
.
Sourcepub unsafe fn get_unchecked_mut<RowRange>(
self,
row: RowRange,
) -> <Self as ColIndex<RowRange>>::Targetwhere
Self: ColIndex<RowRange>,
pub unsafe fn get_unchecked_mut<RowRange>(
self,
row: RowRange,
) -> <Self as ColIndex<RowRange>>::Targetwhere
Self: ColIndex<RowRange>,
Returns references to the element at the given index, or subvector if row
is a
range.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Safety
The behavior is undefined if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.
Sourcepub fn get_mut<RowRange>(
self,
row: RowRange,
) -> <Self as ColIndex<RowRange>>::Targetwhere
Self: ColIndex<RowRange>,
pub fn get_mut<RowRange>(
self,
row: RowRange,
) -> <Self as ColIndex<RowRange>>::Targetwhere
Self: ColIndex<RowRange>,
Returns references to the element at the given index, or subvector if row
is a
range, with bound checks.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Panics
The function panics if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.
Sourcepub unsafe fn read_unchecked(&self, row: usize) -> E
pub unsafe fn read_unchecked(&self, row: usize) -> E
Reads the value of the element at the given index.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.
Sourcepub fn read(&self, row: usize) -> E
pub fn read(&self, row: usize) -> E
Reads the value of the element at the given index, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
row < self.nrows()
.
Sourcepub unsafe fn write_unchecked(&mut self, row: usize, value: E)
pub unsafe fn write_unchecked(&mut self, row: usize, value: E)
Writes the value to the element at the given index.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.
Sourcepub fn write(&mut self, row: usize, value: E)
pub fn write(&mut self, row: usize, value: E)
Writes the value to the element at the given index, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
row < self.nrows()
.
Sourcepub fn copy_from(&mut self, other: impl AsColRef<E>)
pub fn copy_from(&mut self, other: impl AsColRef<E>)
Copies the values from other
into self
.
§Panics
The function panics if any of the following conditions are violated:
self.nrows() == other.nrows()
.self.ncols() == other.ncols()
.
Sourcepub fn fill_zero(&mut self)where
E: ComplexField,
pub fn fill_zero(&mut self)where
E: ComplexField,
Fills the elements of self
with zeros.
Sourcepub fn transpose_mut(self) -> RowMut<'a, E>
pub fn transpose_mut(self) -> RowMut<'a, E>
Returns a view over the transpose of self
.
Sourcepub fn conjugate_mut(self) -> ColMut<'a, E::Conj>where
E: Conjugate,
pub fn conjugate_mut(self) -> ColMut<'a, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn adjoint_mut(self) -> RowMut<'a, E::Conj>where
E: Conjugate,
pub fn adjoint_mut(self) -> RowMut<'a, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Sourcepub fn canonicalize_mut(self) -> (ColMut<'a, E::Canonical>, Conj)where
E: Conjugate,
pub fn canonicalize_mut(self) -> (ColMut<'a, E::Canonical>, Conj)where
E: Conjugate,
Returns a view over the canonical representation of self
, as well as a flag declaring
whether self
is implicitly conjugated or not.
Sourcepub fn reverse_rows_mut(self) -> Self
pub fn reverse_rows_mut(self) -> Self
Returns a view over the self
, with the rows in reversed order.
Sourcepub unsafe fn subrows_mut_unchecked(
self,
row_start: usize,
nrows: usize,
) -> Self
pub unsafe fn subrows_mut_unchecked( self, row_start: usize, nrows: usize, ) -> Self
Returns a view over the subvector starting at row row_start
, and with number of rows
nrows
.
§Safety
The behavior is undefined if any of the following conditions are violated:
row_start <= self.nrows()
.nrows <= self.nrows() - row_start
.
Sourcepub fn subrows_mut(self, row_start: usize, nrows: usize) -> Self
pub fn subrows_mut(self, row_start: usize, nrows: usize) -> Self
Returns a view over the subvector starting at row row_start
, and with number of rows
nrows
.
§Safety
The behavior is undefined if any of the following conditions are violated:
row_start <= self.nrows()
.nrows <= self.nrows() - row_start
.
Sourcepub fn column_vector_as_diagonal(self) -> Matrix<DiagMut<'a, E>>
pub fn column_vector_as_diagonal(self) -> Matrix<DiagMut<'a, E>>
Given a matrix with a single column, returns an object that interprets the column as a diagonal matrix, whoes diagonal elements are values in the column.
Sourcepub fn to_owned(&self) -> Col<E::Canonical>where
E: Conjugate,
pub fn to_owned(&self) -> Col<E::Canonical>where
E: Conjugate,
Returns an owning Col
of the data.
Sourcepub fn has_nan(&self) -> boolwhere
E: ComplexField,
pub fn has_nan(&self) -> boolwhere
E: ComplexField,
Returns true
if any of the elements is NaN, otherwise returns false
.
Sourcepub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
pub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
Returns true
if all of the elements are finite, otherwise returns false
.
Sourcepub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
Returns the maximum norm of self
.
Sourcepub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
Returns the L2 norm of self
.
Sourcepub fn sum(&self) -> Ewhere
E: ComplexField,
pub fn sum(&self) -> Ewhere
E: ComplexField,
Returns the sum of self
.
Source§impl<'a, E: Entity> Matrix<DenseRowRef<'a, E>>
impl<'a, E: Entity> Matrix<DenseRowRef<'a, E>>
Sourcepub fn col_stride(&self) -> isize
pub fn col_stride(&self) -> isize
Returns the column stride of the matrix, specified in number of elements, not in bytes.
Sourcepub fn ptr_at(self, col: usize) -> GroupFor<E, *const E::Unit>
pub fn ptr_at(self, col: usize) -> GroupFor<E, *const E::Unit>
Returns raw pointers to the element at the given index.
Sourcepub unsafe fn ptr_inbounds_at(self, col: usize) -> GroupFor<E, *const E::Unit>
pub unsafe fn ptr_inbounds_at(self, col: usize) -> GroupFor<E, *const E::Unit>
Returns raw pointers to the element at the given index, assuming the provided index is within the size of the vector.
§Safety
The behavior is undefined if any of the following conditions are violated:
col < self.ncols()
.
Sourcepub unsafe fn split_at_unchecked(self, col: usize) -> (Self, Self)
pub unsafe fn split_at_unchecked(self, col: usize) -> (Self, Self)
Splits the column vector at the given index into two parts and returns an array of each subvector, in the following order:
- left.
- right.
§Safety
The behavior is undefined if any of the following conditions are violated:
col <= self.ncols()
.
Sourcepub unsafe fn split_at(self, col: usize) -> (Self, Self)
pub unsafe fn split_at(self, col: usize) -> (Self, Self)
Splits the column vector at the given index into two parts and returns an array of each subvector, in the following order:
- top.
- bottom.
§Panics
The function panics if any of the following conditions are violated:
col <= self.ncols()
.
Sourcepub unsafe fn get_unchecked<ColRange>(
self,
col: ColRange,
) -> <Self as RowIndex<ColRange>>::Targetwhere
Self: RowIndex<ColRange>,
pub unsafe fn get_unchecked<ColRange>(
self,
col: ColRange,
) -> <Self as RowIndex<ColRange>>::Targetwhere
Self: RowIndex<ColRange>,
Returns references to the element at the given index, or subvector if row
is a
range.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Safety
The behavior is undefined if any of the following conditions are violated:
col
must be contained in[0, self.ncols())
.
Sourcepub fn get<ColRange>(
self,
col: ColRange,
) -> <Self as RowIndex<ColRange>>::Targetwhere
Self: RowIndex<ColRange>,
pub fn get<ColRange>(
self,
col: ColRange,
) -> <Self as RowIndex<ColRange>>::Targetwhere
Self: RowIndex<ColRange>,
Returns references to the element at the given index, or subvector if col
is a
range, with bound checks.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Panics
The function panics if any of the following conditions are violated:
col
must be contained in[0, self.ncols())
.
Sourcepub unsafe fn read_unchecked(&self, col: usize) -> E
pub unsafe fn read_unchecked(&self, col: usize) -> E
Reads the value of the element at the given index.
§Safety
The behavior is undefined if any of the following conditions are violated:
col < self.ncols()
.
Sourcepub fn read(&self, col: usize) -> E
pub fn read(&self, col: usize) -> E
Reads the value of the element at the given index, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
col < self.ncols()
.
Sourcepub fn conjugate(self) -> RowRef<'a, E::Conj>where
E: Conjugate,
pub fn conjugate(self) -> RowRef<'a, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn adjoint(self) -> ColRef<'a, E::Conj>where
E: Conjugate,
pub fn adjoint(self) -> ColRef<'a, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Sourcepub fn canonicalize(self) -> (RowRef<'a, E::Canonical>, Conj)where
E: Conjugate,
pub fn canonicalize(self) -> (RowRef<'a, E::Canonical>, Conj)where
E: Conjugate,
Returns a view over the canonical representation of self
, as well as a flag declaring
whether self
is implicitly conjugated or not.
Sourcepub fn reverse_cols(self) -> Self
pub fn reverse_cols(self) -> Self
Returns a view over the self
, with the columnss in reversed order.
Sourcepub unsafe fn subcols_unchecked(self, col_start: usize, ncols: usize) -> Self
pub unsafe fn subcols_unchecked(self, col_start: usize, ncols: usize) -> Self
Returns a view over the subvector starting at column col_start
, and with number of
columns ncols
.
§Safety
The behavior is undefined if any of the following conditions are violated:
col_start <= self.ncols()
.ncols <= self.ncols() - col_start
.
Sourcepub fn subcols(self, col_start: usize, ncols: usize) -> Self
pub fn subcols(self, col_start: usize, ncols: usize) -> Self
Returns a view over the subvector starting at col col_start
, and with number of cols
ncols
.
§Panics
The function panics if any of the following conditions are violated:
col_start <= self.ncols()
.ncols <= self.ncols() - col_start
.
Sourcepub fn to_owned(&self) -> Row<E::Canonical>where
E: Conjugate,
pub fn to_owned(&self) -> Row<E::Canonical>where
E: Conjugate,
Returns an owning Row
of the data.
Sourcepub fn has_nan(&self) -> boolwhere
E: ComplexField,
pub fn has_nan(&self) -> boolwhere
E: ComplexField,
Returns true
if any of the elements is NaN, otherwise returns false
.
Sourcepub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
pub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
Returns true
if all of the elements are finite, otherwise returns false
.
Sourcepub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
Returns the maximum norm of self
.
Sourcepub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
Returns the L2 norm of self
.
Sourcepub fn sum(&self) -> Ewhere
E: ComplexField,
pub fn sum(&self) -> Ewhere
E: ComplexField,
Returns the sum of self
.
Source§impl<'a, E: Entity> Matrix<DenseRowMut<'a, E>>
impl<'a, E: Entity> Matrix<DenseRowMut<'a, E>>
Sourcepub fn as_ptr_mut(self) -> GroupFor<E, *mut E::Unit>
pub fn as_ptr_mut(self) -> GroupFor<E, *mut E::Unit>
Returns pointers to the matrix data.
Sourcepub fn col_stride(&self) -> isize
pub fn col_stride(&self) -> isize
Returns the column stride of the matrix, specified in number of elements, not in bytes.
Sourcepub fn ptr_at_mut(self, col: usize) -> GroupFor<E, *mut E::Unit>
pub fn ptr_at_mut(self, col: usize) -> GroupFor<E, *mut E::Unit>
Returns raw pointers to the element at the given index.
Sourcepub unsafe fn ptr_inbounds_at_mut(self, col: usize) -> GroupFor<E, *mut E::Unit>
pub unsafe fn ptr_inbounds_at_mut(self, col: usize) -> GroupFor<E, *mut E::Unit>
Returns raw pointers to the element at the given index, assuming the provided index is within the size of the vector.
§Safety
The behavior is undefined if any of the following conditions are violated:
col < self.ncols()
.
Sourcepub unsafe fn split_at_mut_unchecked(self, col: usize) -> (Self, Self)
pub unsafe fn split_at_mut_unchecked(self, col: usize) -> (Self, Self)
Splits the column vector at the given index into two parts and returns an array of each subvector, in the following order:
- left.
- right.
§Safety
The behavior is undefined if any of the following conditions are violated:
col <= self.ncols()
.
Sourcepub fn split_at_mut(self, col: usize) -> (Self, Self)
pub fn split_at_mut(self, col: usize) -> (Self, Self)
Splits the column vector at the given index into two parts and returns an array of each subvector, in the following order:
- top.
- bottom.
§Panics
The function panics if any of the following conditions are violated:
col <= self.ncols()
.
Sourcepub unsafe fn get_mut_unchecked<ColRange>(
self,
col: ColRange,
) -> <Self as RowIndex<ColRange>>::Targetwhere
Self: RowIndex<ColRange>,
pub unsafe fn get_mut_unchecked<ColRange>(
self,
col: ColRange,
) -> <Self as RowIndex<ColRange>>::Targetwhere
Self: RowIndex<ColRange>,
Returns references to the element at the given index, or subvector if col
is a
range.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Safety
The behavior is undefined if any of the following conditions are violated:
col
must be contained in[0, self.ncols())
.
Sourcepub fn get_mut<ColRange>(
self,
col: ColRange,
) -> <Self as RowIndex<ColRange>>::Targetwhere
Self: RowIndex<ColRange>,
pub fn get_mut<ColRange>(
self,
col: ColRange,
) -> <Self as RowIndex<ColRange>>::Targetwhere
Self: RowIndex<ColRange>,
Returns references to the element at the given index, or subvector if col
is a
range, with bound checks.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Panics
The function panics if any of the following conditions are violated:
col
must be contained in[0, self.ncols())
.
Sourcepub unsafe fn read_unchecked(&self, col: usize) -> E
pub unsafe fn read_unchecked(&self, col: usize) -> E
Reads the value of the element at the given index.
§Safety
The behavior is undefined if any of the following conditions are violated:
col < self.ncols()
.
Sourcepub fn read(&self, col: usize) -> E
pub fn read(&self, col: usize) -> E
Reads the value of the element at the given index, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
col < self.ncols()
.
Sourcepub unsafe fn write_unchecked(&mut self, col: usize, value: E)
pub unsafe fn write_unchecked(&mut self, col: usize, value: E)
Writes the value to the element at the given index.
§Safety
The behavior is undefined if any of the following conditions are violated:
col < self.ncols()
.
Sourcepub fn write(&mut self, col: usize, value: E)
pub fn write(&mut self, col: usize, value: E)
Writes the value to the element at the given index, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
col < self.ncols()
.
Sourcepub fn copy_from(&mut self, other: impl AsRowRef<E>)
pub fn copy_from(&mut self, other: impl AsRowRef<E>)
Copies the values from other
into self
.
§Panics
The function panics if any of the following conditions are violated:
self.ncols() == other.ncols()
.
Sourcepub fn fill_zero(&mut self)where
E: ComplexField,
pub fn fill_zero(&mut self)where
E: ComplexField,
Fills the elements of self
with zeros.
Sourcepub fn transpose_mut(self) -> ColMut<'a, E>
pub fn transpose_mut(self) -> ColMut<'a, E>
Returns a view over the transpose of self
.
Sourcepub fn conjugate_mut(self) -> RowMut<'a, E::Conj>where
E: Conjugate,
pub fn conjugate_mut(self) -> RowMut<'a, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn adjoint_mut(self) -> ColMut<'a, E::Conj>where
E: Conjugate,
pub fn adjoint_mut(self) -> ColMut<'a, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Sourcepub fn canonicalize_mut(self) -> (RowMut<'a, E::Canonical>, Conj)where
E: Conjugate,
pub fn canonicalize_mut(self) -> (RowMut<'a, E::Canonical>, Conj)where
E: Conjugate,
Returns a view over the canonical representation of self
, as well as a flag declaring
whether self
is implicitly conjugated or not.
Sourcepub fn reverse_cols_mut(self) -> Self
pub fn reverse_cols_mut(self) -> Self
Returns a view over the self
, with the columnss in reversed order.
Sourcepub unsafe fn subcols_mut_unchecked(
self,
col_start: usize,
ncols: usize,
) -> Self
pub unsafe fn subcols_mut_unchecked( self, col_start: usize, ncols: usize, ) -> Self
Returns a view over the subvector starting at col col_start
, and with number of
columns ncols
.
§Safety
The behavior is undefined if any of the following conditions are violated:
col_start <= self.ncols()
.ncols <= self.ncols() - col_start
.
Sourcepub fn subcols_mut(self, col_start: usize, ncols: usize) -> Self
pub fn subcols_mut(self, col_start: usize, ncols: usize) -> Self
Returns a view over the subvector starting at col col_start
, and with number of
columns ncols
.
§Safety
The behavior is undefined if any of the following conditions are violated:
col_start <= self.ncols()
.ncols <= self.ncols() - col_start
.
Sourcepub fn to_owned(&self) -> Row<E::Canonical>where
E: Conjugate,
pub fn to_owned(&self) -> Row<E::Canonical>where
E: Conjugate,
Returns an owning Row
of the data.
Sourcepub fn has_nan(&self) -> boolwhere
E: ComplexField,
pub fn has_nan(&self) -> boolwhere
E: ComplexField,
Returns true
if any of the elements is NaN, otherwise returns false
.
Sourcepub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
pub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
Returns true
if all of the elements are finite, otherwise returns false
.
Sourcepub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
Returns the maximum norm of self
.
Sourcepub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
Returns the L2 norm of self
.
Sourcepub fn sum(&self) -> Ewhere
E: ComplexField,
pub fn sum(&self) -> Ewhere
E: ComplexField,
Returns the sum of self
.
Source§impl<'a, E: Entity> Matrix<DenseRef<'a, E>>
impl<'a, E: Entity> Matrix<DenseRef<'a, E>>
Sourcepub fn row_stride(&self) -> isize
pub fn row_stride(&self) -> isize
Returns the row stride of the matrix, specified in number of elements, not in bytes.
Sourcepub fn col_stride(&self) -> isize
pub fn col_stride(&self) -> isize
Returns the column stride of the matrix, specified in number of elements, not in bytes.
Sourcepub fn ptr_at(self, row: usize, col: usize) -> GroupFor<E, *const E::Unit>
pub fn ptr_at(self, row: usize, col: usize) -> GroupFor<E, *const E::Unit>
Returns raw pointers to the element at the given indices.
Sourcepub unsafe fn ptr_inbounds_at(
self,
row: usize,
col: usize,
) -> GroupFor<E, *const E::Unit>
pub unsafe fn ptr_inbounds_at( self, row: usize, col: usize, ) -> GroupFor<E, *const E::Unit>
Returns raw pointers to the element at the given indices, assuming the provided indices are within the matrix dimensions.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.col < self.ncols()
.
Sourcepub unsafe fn split_at_unchecked(
self,
row: usize,
col: usize,
) -> (Self, Self, Self, Self)
pub unsafe fn split_at_unchecked( self, row: usize, col: usize, ) -> (Self, Self, Self, Self)
Splits the matrix horizontally and vertically at the given indices into four corners and returns an array of each submatrix, in the following order:
- top left.
- top right.
- bottom left.
- bottom right.
§Safety
The behavior is undefined if any of the following conditions are violated:
row <= self.nrows()
.col <= self.ncols()
.
Sourcepub fn split_at(self, row: usize, col: usize) -> (Self, Self, Self, Self)
pub fn split_at(self, row: usize, col: usize) -> (Self, Self, Self, Self)
Splits the matrix horizontally and vertically at the given indices into four corners and returns an array of each submatrix, in the following order:
- top left.
- top right.
- bottom left.
- bottom right.
§Panics
The function panics if any of the following conditions are violated:
row <= self.nrows()
.col <= self.ncols()
.
Sourcepub unsafe fn split_at_row_unchecked(self, row: usize) -> (Self, Self)
pub unsafe fn split_at_row_unchecked(self, row: usize) -> (Self, Self)
Splits the matrix horizontally at the given row into two parts and returns an array of each submatrix, in the following order:
- top.
- bottom.
§Safety
The behavior is undefined if the following condition is violated:
row <= self.nrows()
.
Sourcepub fn split_at_row(self, row: usize) -> (Self, Self)
pub fn split_at_row(self, row: usize) -> (Self, Self)
Splits the matrix horizontally at the given row into two parts and returns an array of each submatrix, in the following order:
- top.
- bottom.
§Panics
The function panics if the following condition is violated:
row <= self.nrows()
.
Sourcepub unsafe fn split_at_col_unchecked(self, col: usize) -> (Self, Self)
pub unsafe fn split_at_col_unchecked(self, col: usize) -> (Self, Self)
Splits the matrix vertically at the given row into two parts and returns an array of each submatrix, in the following order:
- left.
- right.
§Safety
The behavior is undefined if the following condition is violated:
col <= self.ncols()
.
Sourcepub fn split_at_col(self, col: usize) -> (Self, Self)
pub fn split_at_col(self, col: usize) -> (Self, Self)
Splits the matrix vertically at the given row into two parts and returns an array of each submatrix, in the following order:
- left.
- right.
§Panics
The function panics if the following condition is violated:
col <= self.ncols()
.
Sourcepub unsafe fn get_unchecked<RowRange, ColRange>(
self,
row: RowRange,
col: ColRange,
) -> <Self as MatIndex<RowRange, ColRange>>::Targetwhere
Self: MatIndex<RowRange, ColRange>,
pub unsafe fn get_unchecked<RowRange, ColRange>(
self,
row: RowRange,
col: ColRange,
) -> <Self as MatIndex<RowRange, ColRange>>::Targetwhere
Self: MatIndex<RowRange, ColRange>,
Returns references to the element at the given indices, or submatrices if either row
or col
is a range.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Safety
The behavior is undefined if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.col
must be contained in[0, self.ncols())
.
Sourcepub fn get<RowRange, ColRange>(
self,
row: RowRange,
col: ColRange,
) -> <Self as MatIndex<RowRange, ColRange>>::Targetwhere
Self: MatIndex<RowRange, ColRange>,
pub fn get<RowRange, ColRange>(
self,
row: RowRange,
col: ColRange,
) -> <Self as MatIndex<RowRange, ColRange>>::Targetwhere
Self: MatIndex<RowRange, ColRange>,
Returns references to the element at the given indices, or submatrices if either row
or col
is a range, with bound checks.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Panics
The function panics if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.col
must be contained in[0, self.ncols())
.
Sourcepub unsafe fn read_unchecked(&self, row: usize, col: usize) -> E
pub unsafe fn read_unchecked(&self, row: usize, col: usize) -> E
Reads the value of the element at the given indices.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.col < self.ncols()
.
Sourcepub fn read(&self, row: usize, col: usize) -> E
pub fn read(&self, row: usize, col: usize) -> E
Reads the value of the element at the given indices, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
row < self.nrows()
.col < self.ncols()
.
Sourcepub fn transpose(self) -> Self
pub fn transpose(self) -> Self
Returns a view over the transpose of self
.
§Example
use faer_core::mat;
let matrix = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
let view = matrix.as_ref();
let transpose = view.transpose();
let expected = mat![[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]];
assert_eq!(expected.as_ref(), transpose);
Sourcepub fn conjugate(self) -> MatRef<'a, E::Conj>where
E: Conjugate,
pub fn conjugate(self) -> MatRef<'a, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn adjoint(self) -> MatRef<'a, E::Conj>where
E: Conjugate,
pub fn adjoint(self) -> MatRef<'a, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Sourcepub fn canonicalize(self) -> (MatRef<'a, E::Canonical>, Conj)where
E: Conjugate,
pub fn canonicalize(self) -> (MatRef<'a, E::Canonical>, Conj)where
E: Conjugate,
Returns a view over the canonical representation of self
, as well as a flag declaring
whether self
is implicitly conjugated or not.
Sourcepub fn reverse_rows(self) -> Self
pub fn reverse_rows(self) -> Self
Returns a view over the self
, with the rows in reversed order.
§Example
use faer_core::mat;
let matrix = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
let view = matrix.as_ref();
let reversed_rows = view.reverse_rows();
let expected = mat![[4.0, 5.0, 6.0], [1.0, 2.0, 3.0]];
assert_eq!(expected.as_ref(), reversed_rows);
Sourcepub fn reverse_cols(self) -> Self
pub fn reverse_cols(self) -> Self
Returns a view over the self
, with the columns in reversed order.
§Example
use faer_core::mat;
let matrix = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
let view = matrix.as_ref();
let reversed_cols = view.reverse_cols();
let expected = mat![[3.0, 2.0, 1.0], [6.0, 5.0, 4.0]];
assert_eq!(expected.as_ref(), reversed_cols);
Sourcepub fn reverse_rows_and_cols(self) -> Self
pub fn reverse_rows_and_cols(self) -> Self
Returns a view over the self
, with the rows and the columns in reversed order.
§Example
use faer_core::mat;
let matrix = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
let view = matrix.as_ref();
let reversed = view.reverse_rows_and_cols();
let expected = mat![[6.0, 5.0, 4.0], [3.0, 2.0, 1.0]];
assert_eq!(expected.as_ref(), reversed);
Sourcepub unsafe fn submatrix_unchecked(
self,
row_start: usize,
col_start: usize,
nrows: usize,
ncols: usize,
) -> Self
pub unsafe fn submatrix_unchecked( self, row_start: usize, col_start: usize, nrows: usize, ncols: usize, ) -> Self
Returns a view over the submatrix starting at indices (row_start, col_start)
, and with
dimensions (nrows, ncols)
.
§Safety
The behavior is undefined if any of the following conditions are violated:
row_start <= self.nrows()
.col_start <= self.ncols()
.nrows <= self.nrows() - row_start
.ncols <= self.ncols() - col_start
.
Sourcepub fn submatrix(
self,
row_start: usize,
col_start: usize,
nrows: usize,
ncols: usize,
) -> Self
pub fn submatrix( self, row_start: usize, col_start: usize, nrows: usize, ncols: usize, ) -> Self
Returns a view over the submatrix starting at indices (row_start, col_start)
, and with
dimensions (nrows, ncols)
.
§Panics
The function panics if any of the following conditions are violated:
row_start <= self.nrows()
.col_start <= self.ncols()
.nrows <= self.nrows() - row_start
.ncols <= self.ncols() - col_start
.
§Example
use faer_core::mat;
let matrix = mat![
[1.0, 5.0, 9.0],
[2.0, 6.0, 10.0],
[3.0, 7.0, 11.0],
[4.0, 8.0, 12.0f64],
];
let view = matrix.as_ref();
let submatrix = view.submatrix(2, 1, 2, 2);
let expected = mat![[7.0, 11.0], [8.0, 12.0f64]];
assert_eq!(expected.as_ref(), submatrix);
Sourcepub unsafe fn subrows_unchecked(self, row_start: usize, nrows: usize) -> Self
pub unsafe fn subrows_unchecked(self, row_start: usize, nrows: usize) -> Self
Returns a view over the submatrix starting at row row_start
, and with number of rows
nrows
.
§Safety
The behavior is undefined if any of the following conditions are violated:
row_start <= self.nrows()
.nrows <= self.nrows() - row_start
.
Sourcepub fn subrows(self, row_start: usize, nrows: usize) -> Self
pub fn subrows(self, row_start: usize, nrows: usize) -> Self
Returns a view over the submatrix starting at row row_start
, and with number of rows
nrows
.
§Panics
The function panics if any of the following conditions are violated:
row_start <= self.nrows()
.nrows <= self.nrows() - row_start
.
§Example
use faer_core::mat;
let matrix = mat![
[1.0, 5.0, 9.0],
[2.0, 6.0, 10.0],
[3.0, 7.0, 11.0],
[4.0, 8.0, 12.0f64],
];
let view = matrix.as_ref();
let subrows = view.subrows(1, 2);
let expected = mat![[2.0, 6.0, 10.0], [3.0, 7.0, 11.0],];
assert_eq!(expected.as_ref(), subrows);
Sourcepub unsafe fn subcols_unchecked(self, col_start: usize, ncols: usize) -> Self
pub unsafe fn subcols_unchecked(self, col_start: usize, ncols: usize) -> Self
Returns a view over the submatrix starting at column col_start
, and with number of
columns ncols
.
§Safety
The behavior is undefined if any of the following conditions are violated:
col_start <= self.ncols()
.ncols <= self.ncols() - col_start
.
Sourcepub fn subcols(self, col_start: usize, ncols: usize) -> Self
pub fn subcols(self, col_start: usize, ncols: usize) -> Self
Returns a view over the submatrix starting at column col_start
, and with number of
columns ncols
.
§Panics
The function panics if any of the following conditions are violated:
col_start <= self.ncols()
.ncols <= self.ncols() - col_start
.
§Example
use faer_core::mat;
let matrix = mat![
[1.0, 5.0, 9.0],
[2.0, 6.0, 10.0],
[3.0, 7.0, 11.0],
[4.0, 8.0, 12.0f64],
];
let view = matrix.as_ref();
let subcols = view.subcols(2, 1);
let expected = mat![[9.0], [10.0], [11.0], [12.0f64]];
assert_eq!(expected.as_ref(), subcols);
Sourcepub unsafe fn row_unchecked(self, row_idx: usize) -> RowRef<'a, E>
pub unsafe fn row_unchecked(self, row_idx: usize) -> RowRef<'a, E>
Returns a view over the row at the given index.
§Safety
The function panics if any of the following conditions are violated:
row_idx < self.nrows()
.
Sourcepub fn row(self, row_idx: usize) -> RowRef<'a, E>
pub fn row(self, row_idx: usize) -> RowRef<'a, E>
Returns a view over the row at the given index.
§Panics
The function panics if any of the following conditions are violated:
row_idx < self.nrows()
.
Sourcepub unsafe fn col_unchecked(self, col_idx: usize) -> ColRef<'a, E>
pub unsafe fn col_unchecked(self, col_idx: usize) -> ColRef<'a, E>
Returns a view over the column at the given index.
§Safety
The behavior is undefined if any of the following conditions are violated:
col_idx < self.ncols()
.
Sourcepub fn col(self, col_idx: usize) -> ColRef<'a, E>
pub fn col(self, col_idx: usize) -> ColRef<'a, E>
Returns a view over the column at the given index.
§Panics
The function panics if any of the following conditions are violated:
col_idx < self.ncols()
.
Sourcepub fn column_vector_as_diagonal(self) -> Matrix<DiagRef<'a, E>>
pub fn column_vector_as_diagonal(self) -> Matrix<DiagRef<'a, E>>
Given a matrix with a single column, returns an object that interprets the column as a diagonal matrix, whoes diagonal elements are values in the column.
Sourcepub fn to_owned(&self) -> Mat<E::Canonical>where
E: Conjugate,
pub fn to_owned(&self) -> Mat<E::Canonical>where
E: Conjugate,
Returns an owning Mat
of the data.
Sourcepub fn has_nan(&self) -> boolwhere
E: ComplexField,
pub fn has_nan(&self) -> boolwhere
E: ComplexField,
Returns true
if any of the elements is NaN, otherwise returns false
.
Sourcepub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
pub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
Returns true
if all of the elements are finite, otherwise returns false
.
Sourcepub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
Returns the maximum norm of self
.
Sourcepub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
Returns the L2 norm of self
.
Sourcepub fn sum(&self) -> Ewhere
E: ComplexField,
pub fn sum(&self) -> Ewhere
E: ComplexField,
Returns the sum of self
.
Sourcepub fn kron(&self, rhs: impl As2D<E>) -> Mat<E>where
E: ComplexField,
pub fn kron(&self, rhs: impl As2D<E>) -> Mat<E>where
E: ComplexField,
Kroneckor product of self
and rhs
.
This is an allocating operation; see kron
for the
allocation-free version or more info in general.
Sourcepub fn col_chunks(
self,
chunk_size: usize,
) -> impl 'a + DoubleEndedIterator<Item = MatRef<'a, E>>
pub fn col_chunks( self, chunk_size: usize, ) -> impl 'a + DoubleEndedIterator<Item = MatRef<'a, E>>
Returns an iterator that provides successive chunks of the columns of this matrix, with
each having at most chunk_size
columns.
If the number of columns is a multiple of chunk_size
, then all chunks have
chunk_size
columns.
Sourcepub fn row_chunks(
self,
chunk_size: usize,
) -> impl 'a + DoubleEndedIterator<Item = MatRef<'a, E>>
pub fn row_chunks( self, chunk_size: usize, ) -> impl 'a + DoubleEndedIterator<Item = MatRef<'a, E>>
Returns an iterator that provides successive chunks of the rows of this matrix, with
each having at most chunk_size
rows.
If the number of rows is a multiple of chunk_size
, then all chunks have chunk_size
rows.
Sourcepub fn par_col_chunks(
self,
chunk_size: usize,
) -> impl 'a + IndexedParallelIterator<Item = MatRef<'a, E>>
Available on crate feature rayon
only.
pub fn par_col_chunks( self, chunk_size: usize, ) -> impl 'a + IndexedParallelIterator<Item = MatRef<'a, E>>
rayon
only.Returns a parallel iterator that provides successive chunks of the columns of this
matrix, with each having at most chunk_size
columns.
If the number of columns is a multiple of chunk_size
, then all chunks have
chunk_size
columns.
Only available with the rayon
feature.
Sourcepub fn par_row_chunks(
self,
chunk_size: usize,
) -> impl 'a + IndexedParallelIterator<Item = MatRef<'a, E>>
Available on crate feature rayon
only.
pub fn par_row_chunks( self, chunk_size: usize, ) -> impl 'a + IndexedParallelIterator<Item = MatRef<'a, E>>
rayon
only.Returns a parallel iterator that provides successive chunks of the rows of this matrix,
with each having at most chunk_size
rows.
If the number of rows is a multiple of chunk_size
, then all chunks have chunk_size
rows.
Only available with the rayon
feature.
Sourcepub fn into_par_row_chunks(
self,
chunk_size: usize,
) -> impl 'a + IndexedParallelIterator<Item = MatRef<'a, E>>
👎Deprecated: replaced by MatRef::par_row_chunks
Available on crate feature rayon
only.
pub fn into_par_row_chunks( self, chunk_size: usize, ) -> impl 'a + IndexedParallelIterator<Item = MatRef<'a, E>>
MatRef::par_row_chunks
rayon
only.Returns a parallel iterator that provides successive chunks of the rows of this matrix,
with each having at most chunk_size
rows.
If the number of rows is a multiple of chunk_size
, then all chunks have chunk_size
rows.
Only available with the rayon
feature.
Source§impl<'a, E: Entity> Matrix<DenseMut<'a, E>>
impl<'a, E: Entity> Matrix<DenseMut<'a, E>>
Sourcepub fn as_ptr_mut(self) -> GroupFor<E, *mut E::Unit>
pub fn as_ptr_mut(self) -> GroupFor<E, *mut E::Unit>
Returns pointers to the matrix data.
Sourcepub fn row_stride(&self) -> isize
pub fn row_stride(&self) -> isize
Returns the row stride of the matrix, specified in number of elements, not in bytes.
Sourcepub fn col_stride(&self) -> isize
pub fn col_stride(&self) -> isize
Returns the column stride of the matrix, specified in number of elements, not in bytes.
Sourcepub fn ptr_at_mut(self, row: usize, col: usize) -> GroupFor<E, *mut E::Unit>
pub fn ptr_at_mut(self, row: usize, col: usize) -> GroupFor<E, *mut E::Unit>
Returns raw pointers to the element at the given indices.
Sourcepub unsafe fn ptr_inbounds_at_mut(
self,
row: usize,
col: usize,
) -> GroupFor<E, *mut E::Unit>
pub unsafe fn ptr_inbounds_at_mut( self, row: usize, col: usize, ) -> GroupFor<E, *mut E::Unit>
Returns raw pointers to the element at the given indices, assuming the provided indices are within the matrix dimensions.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.col < self.ncols()
.
Sourcepub unsafe fn split_at_mut_unchecked(
self,
row: usize,
col: usize,
) -> (Self, Self, Self, Self)
pub unsafe fn split_at_mut_unchecked( self, row: usize, col: usize, ) -> (Self, Self, Self, Self)
Splits the matrix horizontally and vertically at the given indices into four corners and returns an array of each submatrix, in the following order:
- top left.
- top right.
- bottom left.
- bottom right.
§Safety
The behavior is undefined if any of the following conditions are violated:
row <= self.nrows()
.col <= self.ncols()
.
Sourcepub fn split_at_mut(self, row: usize, col: usize) -> (Self, Self, Self, Self)
pub fn split_at_mut(self, row: usize, col: usize) -> (Self, Self, Self, Self)
Splits the matrix horizontally and vertically at the given indices into four corners and returns an array of each submatrix, in the following order:
- top left.
- top right.
- bottom left.
- bottom right.
§Panics
The function panics if any of the following conditions are violated:
row <= self.nrows()
.col <= self.ncols()
.
Sourcepub unsafe fn split_at_row_mut_unchecked(self, row: usize) -> (Self, Self)
pub unsafe fn split_at_row_mut_unchecked(self, row: usize) -> (Self, Self)
Splits the matrix horizontally at the given row into two parts and returns an array of each submatrix, in the following order:
- top.
- bottom.
§Safety
The behavior is undefined if the following condition is violated:
row <= self.nrows()
.
Sourcepub fn split_at_row_mut(self, row: usize) -> (Self, Self)
pub fn split_at_row_mut(self, row: usize) -> (Self, Self)
Splits the matrix horizontally at the given row into two parts and returns an array of each submatrix, in the following order:
- top.
- bottom.
§Panics
The function panics if the following condition is violated:
row <= self.nrows()
.
Sourcepub unsafe fn split_at_col_mut_unchecked(self, col: usize) -> (Self, Self)
pub unsafe fn split_at_col_mut_unchecked(self, col: usize) -> (Self, Self)
Splits the matrix vertically at the given row into two parts and returns an array of each submatrix, in the following order:
- left.
- right.
§Safety
The behavior is undefined if the following condition is violated:
col <= self.ncols()
.
Sourcepub fn split_at_col_mut(self, col: usize) -> (Self, Self)
pub fn split_at_col_mut(self, col: usize) -> (Self, Self)
Splits the matrix vertically at the given row into two parts and returns an array of each submatrix, in the following order:
- left.
- right.
§Panics
The function panics if the following condition is violated:
col <= self.ncols()
.
Sourcepub unsafe fn get_mut_unchecked<RowRange, ColRange>(
self,
row: RowRange,
col: ColRange,
) -> <Self as MatIndex<RowRange, ColRange>>::Targetwhere
Self: MatIndex<RowRange, ColRange>,
pub unsafe fn get_mut_unchecked<RowRange, ColRange>(
self,
row: RowRange,
col: ColRange,
) -> <Self as MatIndex<RowRange, ColRange>>::Targetwhere
Self: MatIndex<RowRange, ColRange>,
Returns mutable references to the element at the given indices, or submatrices if either
row
or col
is a range.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Safety
The behavior is undefined if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.col
must be contained in[0, self.ncols())
.
Sourcepub fn get_mut<RowRange, ColRange>(
self,
row: RowRange,
col: ColRange,
) -> <Self as MatIndex<RowRange, ColRange>>::Targetwhere
Self: MatIndex<RowRange, ColRange>,
pub fn get_mut<RowRange, ColRange>(
self,
row: RowRange,
col: ColRange,
) -> <Self as MatIndex<RowRange, ColRange>>::Targetwhere
Self: MatIndex<RowRange, ColRange>,
Returns mutable references to the element at the given indices, or submatrices if either
row
or col
is a range, with bound checks.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Panics
The function panics if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.col
must be contained in[0, self.ncols())
.
Sourcepub unsafe fn read_unchecked(&self, row: usize, col: usize) -> E
pub unsafe fn read_unchecked(&self, row: usize, col: usize) -> E
Reads the value of the element at the given indices.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.col < self.ncols()
.
Sourcepub fn read(&self, row: usize, col: usize) -> E
pub fn read(&self, row: usize, col: usize) -> E
Reads the value of the element at the given indices, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
row < self.nrows()
.col < self.ncols()
.
Sourcepub unsafe fn write_unchecked(&mut self, row: usize, col: usize, value: E)
pub unsafe fn write_unchecked(&mut self, row: usize, col: usize, value: E)
Writes the value to the element at the given indices.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.col < self.ncols()
.
Sourcepub fn write(&mut self, row: usize, col: usize, value: E)
pub fn write(&mut self, row: usize, col: usize, value: E)
Writes the value to the element at the given indices, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
row < self.nrows()
.col < self.ncols()
.
Sourcepub fn copy_from_triangular_lower(&mut self, other: impl AsMatRef<E>)
pub fn copy_from_triangular_lower(&mut self, other: impl AsMatRef<E>)
Copies the values from the lower triangular part of other
into the lower triangular
part of self
. The diagonal part is included.
§Panics
The function panics if any of the following conditions are violated:
self.nrows() == other.nrows()
.self.ncols() == other.ncols()
.self.nrows() == self.ncols()
.
Sourcepub fn copy_from_strict_triangular_lower(&mut self, other: impl AsMatRef<E>)
pub fn copy_from_strict_triangular_lower(&mut self, other: impl AsMatRef<E>)
Copies the values from the lower triangular part of other
into the lower triangular
part of self
. The diagonal part is excluded.
§Panics
The function panics if any of the following conditions are violated:
self.nrows() == other.nrows()
.self.ncols() == other.ncols()
.self.nrows() == self.ncols()
.
Sourcepub fn copy_from_triangular_upper(&mut self, other: impl AsMatRef<E>)
pub fn copy_from_triangular_upper(&mut self, other: impl AsMatRef<E>)
Copies the values from the upper triangular part of other
into the upper triangular
part of self
. The diagonal part is included.
§Panics
The function panics if any of the following conditions are violated:
self.nrows() == other.nrows()
.self.ncols() == other.ncols()
.self.nrows() == self.ncols()
.
Sourcepub fn copy_from_strict_triangular_upper(&mut self, other: impl AsMatRef<E>)
pub fn copy_from_strict_triangular_upper(&mut self, other: impl AsMatRef<E>)
Copies the values from the upper triangular part of other
into the upper triangular
part of self
. The diagonal part is excluded.
§Panics
The function panics if any of the following conditions are violated:
self.nrows() == other.nrows()
.self.ncols() == other.ncols()
.self.nrows() == self.ncols()
.
Sourcepub fn copy_from(&mut self, other: impl AsMatRef<E>)
pub fn copy_from(&mut self, other: impl AsMatRef<E>)
Copies the values from other
into self
.
§Panics
The function panics if any of the following conditions are violated:
self.nrows() == other.nrows()
.self.ncols() == other.ncols()
.
Sourcepub fn fill_zero(&mut self)where
E: ComplexField,
pub fn fill_zero(&mut self)where
E: ComplexField,
Fills the elements of self
with zeros.
Sourcepub fn transpose_mut(self) -> Self
pub fn transpose_mut(self) -> Self
Returns a view over the transpose of self
.
§Example
use faer_core::mat;
let mut matrix = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
let view = matrix.as_mut();
let transpose = view.transpose_mut();
let mut expected = mat![[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]];
assert_eq!(expected.as_mut(), transpose);
Sourcepub fn conjugate_mut(self) -> MatMut<'a, E::Conj>where
E: Conjugate,
pub fn conjugate_mut(self) -> MatMut<'a, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn adjoint_mut(self) -> MatMut<'a, E::Conj>where
E: Conjugate,
pub fn adjoint_mut(self) -> MatMut<'a, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Sourcepub fn canonicalize_mut(self) -> (MatMut<'a, E::Canonical>, Conj)where
E: Conjugate,
pub fn canonicalize_mut(self) -> (MatMut<'a, E::Canonical>, Conj)where
E: Conjugate,
Returns a view over the canonical representation of self
, as well as a flag declaring
whether self
is implicitly conjugated or not.
Sourcepub fn reverse_rows_mut(self) -> Self
pub fn reverse_rows_mut(self) -> Self
Returns a view over the self
, with the rows in reversed order.
§Example
use faer_core::mat;
let mut matrix = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
let view = matrix.as_mut();
let reversed_rows = view.reverse_rows_mut();
let mut expected = mat![[4.0, 5.0, 6.0], [1.0, 2.0, 3.0]];
assert_eq!(expected.as_mut(), reversed_rows);
Sourcepub fn reverse_cols_mut(self) -> Self
pub fn reverse_cols_mut(self) -> Self
Returns a view over the self
, with the columns in reversed order.
§Example
use faer_core::mat;
let mut matrix = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
let view = matrix.as_mut();
let reversed_cols = view.reverse_cols_mut();
let mut expected = mat![[3.0, 2.0, 1.0], [6.0, 5.0, 4.0]];
assert_eq!(expected.as_mut(), reversed_cols);
Sourcepub fn reverse_rows_and_cols_mut(self) -> Self
pub fn reverse_rows_and_cols_mut(self) -> Self
Returns a view over the self
, with the rows and the columns in reversed order.
§Example
use faer_core::mat;
let mut matrix = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
let view = matrix.as_mut();
let reversed = view.reverse_rows_and_cols_mut();
let mut expected = mat![[6.0, 5.0, 4.0], [3.0, 2.0, 1.0]];
assert_eq!(expected.as_mut(), reversed);
Sourcepub fn submatrix_mut(
self,
row_start: usize,
col_start: usize,
nrows: usize,
ncols: usize,
) -> Self
pub fn submatrix_mut( self, row_start: usize, col_start: usize, nrows: usize, ncols: usize, ) -> Self
Returns a view over the submatrix starting at indices (row_start, col_start)
, and with
dimensions (nrows, ncols)
.
§Panics
The function panics if any of the following conditions are violated:
row_start <= self.nrows()
.col_start <= self.ncols()
.nrows <= self.nrows() - row_start
.ncols <= self.ncols() - col_start
.
§Example
use faer_core::mat;
let mut matrix = mat![
[1.0, 5.0, 9.0],
[2.0, 6.0, 10.0],
[3.0, 7.0, 11.0],
[4.0, 8.0, 12.0f64],
];
let view = matrix.as_mut();
let submatrix = view.submatrix_mut(2, 1, 2, 2);
let mut expected = mat![[7.0, 11.0], [8.0, 12.0f64]];
assert_eq!(expected.as_mut(), submatrix);
Sourcepub fn subrows_mut(self, row_start: usize, nrows: usize) -> Self
pub fn subrows_mut(self, row_start: usize, nrows: usize) -> Self
Returns a view over the submatrix starting at row row_start
, and with number of rows
nrows
.
§Panics
The function panics if any of the following conditions are violated:
row_start <= self.nrows()
.nrows <= self.nrows() - row_start
.
§Example
use faer_core::mat;
let mut matrix = mat![
[1.0, 5.0, 9.0],
[2.0, 6.0, 10.0],
[3.0, 7.0, 11.0],
[4.0, 8.0, 12.0f64],
];
let view = matrix.as_mut();
let subrows = view.subrows_mut(1, 2);
let mut expected = mat![[2.0, 6.0, 10.0], [3.0, 7.0, 11.0],];
assert_eq!(expected.as_mut(), subrows);
Sourcepub fn subcols_mut(self, col_start: usize, ncols: usize) -> Self
pub fn subcols_mut(self, col_start: usize, ncols: usize) -> Self
Returns a view over the submatrix starting at column col_start
, and with number of
columns ncols
.
§Panics
The function panics if any of the following conditions are violated:
col_start <= self.ncols()
.ncols <= self.ncols() - col_start
.
§Example
use faer_core::mat;
let mut matrix = mat![
[1.0, 5.0, 9.0],
[2.0, 6.0, 10.0],
[3.0, 7.0, 11.0],
[4.0, 8.0, 12.0f64],
];
let view = matrix.as_mut();
let subcols = view.subcols_mut(2, 1);
let mut expected = mat![[9.0], [10.0], [11.0], [12.0f64]];
assert_eq!(expected.as_mut(), subcols);
Sourcepub fn row_mut(self, row_idx: usize) -> RowMut<'a, E>
pub fn row_mut(self, row_idx: usize) -> RowMut<'a, E>
Returns a view over the row at the given index.
§Panics
The function panics if any of the following conditions are violated:
row_idx < self.nrows()
.
Sourcepub fn col_mut(self, col_idx: usize) -> ColMut<'a, E>
pub fn col_mut(self, col_idx: usize) -> ColMut<'a, E>
Returns a view over the column at the given index.
§Panics
The function panics if any of the following conditions are violated:
col_idx < self.ncols()
.
Sourcepub fn column_vector_as_diagonal_mut(self) -> Matrix<DiagMut<'a, E>>
pub fn column_vector_as_diagonal_mut(self) -> Matrix<DiagMut<'a, E>>
Given a matrix with a single column, returns an object that interprets the column as a diagonal matrix, whoes diagonal elements are values in the column.
Sourcepub fn diagonal_mut(self) -> Matrix<DiagMut<'a, E>>
pub fn diagonal_mut(self) -> Matrix<DiagMut<'a, E>>
Returns the diagonal of the matrix.
Sourcepub fn to_owned(&self) -> Mat<E::Canonical>where
E: Conjugate,
pub fn to_owned(&self) -> Mat<E::Canonical>where
E: Conjugate,
Returns an owning Mat
of the data
Sourcepub fn has_nan(&self) -> boolwhere
E: ComplexField,
pub fn has_nan(&self) -> boolwhere
E: ComplexField,
Returns true
if any of the elements is NaN, otherwise returns false
.
Sourcepub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
pub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
Returns true
if all of the elements are finite, otherwise returns false
.
Sourcepub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
Returns the maximum norm of self
.
Sourcepub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
Returns the L2 norm of self
.
Sourcepub fn sum(&self) -> Ewhere
E: ComplexField,
pub fn sum(&self) -> Ewhere
E: ComplexField,
Returns the sum of self
.
Sourcepub fn kron(&self, rhs: impl As2D<E>) -> Mat<E>where
E: ComplexField,
pub fn kron(&self, rhs: impl As2D<E>) -> Mat<E>where
E: ComplexField,
Kroneckor product of self
and rhs
.
This is an allocating operation; see kron
for the
allocation-free version or more info in general.
Sourcepub fn col_chunks_mut(
self,
chunk_size: usize,
) -> impl 'a + DoubleEndedIterator<Item = MatMut<'a, E>>
pub fn col_chunks_mut( self, chunk_size: usize, ) -> impl 'a + DoubleEndedIterator<Item = MatMut<'a, E>>
Returns an iterator that provides successive chunks of the columns of this matrix, with
each having at most chunk_size
columns.
If the number of columns is a multiple of chunk_size
, then all chunks have
chunk_size
columns.
Sourcepub fn row_chunks_mut(
self,
chunk_size: usize,
) -> impl 'a + DoubleEndedIterator<Item = MatMut<'a, E>>
pub fn row_chunks_mut( self, chunk_size: usize, ) -> impl 'a + DoubleEndedIterator<Item = MatMut<'a, E>>
Returns an iterator that provides successive chunks of the rows of this matrix,
with each having at most chunk_size
rows.
If the number of rows is a multiple of chunk_size
, then all chunks have chunk_size
rows.
Sourcepub fn par_col_chunks_mut(
self,
chunk_size: usize,
) -> impl 'a + IndexedParallelIterator<Item = MatMut<'a, E>>
Available on crate feature rayon
only.
pub fn par_col_chunks_mut( self, chunk_size: usize, ) -> impl 'a + IndexedParallelIterator<Item = MatMut<'a, E>>
rayon
only.Returns a parallel iterator that provides successive chunks of the columns of this
matrix, with each having at most chunk_size
columns.
If the number of columns is a multiple of chunk_size
, then all chunks have
chunk_size
columns.
Only available with the rayon
feature.
Sourcepub fn par_row_chunks_mut(
self,
chunk_size: usize,
) -> impl 'a + IndexedParallelIterator<Item = MatMut<'a, E>>
Available on crate feature rayon
only.
pub fn par_row_chunks_mut( self, chunk_size: usize, ) -> impl 'a + IndexedParallelIterator<Item = MatMut<'a, E>>
rayon
only.Returns a parallel iterator that provides successive chunks of the rows of this matrix,
with each having at most chunk_size
rows.
If the number of rows is a multiple of chunk_size
, then all chunks have chunk_size
rows.
Only available with the rayon
feature.
Source§impl<'a, E: RealField> Matrix<DenseMut<'a, Complex<E>>>
impl<'a, E: RealField> Matrix<DenseMut<'a, Complex<E>>>
Sourcepub fn real_imag_mut(self) -> Complex<MatMut<'a, E>>
pub fn real_imag_mut(self) -> Complex<MatMut<'a, E>>
Returns the real and imaginary components of self
.
Source§impl<E: Entity> Matrix<DenseColOwn<E>>
impl<E: Entity> Matrix<DenseColOwn<E>>
Sourcepub fn with_capacity(row_capacity: usize) -> Self
pub fn with_capacity(row_capacity: usize) -> Self
Returns a new column vector with 0 rows, with enough capacity to hold a maximum of
row_capacity
rows columns without reallocating. If row_capacity
is 0
,
the function will not allocate.
§Panics
The function panics if the total capacity in bytes exceeds isize::MAX
.
Sourcepub fn from_fn(nrows: usize, f: impl FnMut(usize) -> E) -> Self
pub fn from_fn(nrows: usize, f: impl FnMut(usize) -> E) -> Self
Returns a new matrix with number of rows nrows
, filled with the provided function.
§Panics
The function panics if the total capacity in bytes exceeds isize::MAX
.
Sourcepub fn zeros(nrows: usize) -> Selfwhere
E: ComplexField,
pub fn zeros(nrows: usize) -> Selfwhere
E: ComplexField,
Returns a new matrix with number of rows nrows
, filled with zeros.
§Panics
The function panics if the total capacity in bytes exceeds isize::MAX
.
Sourcepub fn ncols(&self) -> usize
pub fn ncols(&self) -> usize
Returns the number of columns of the column. This is always equal to 1
.
Sourcepub unsafe fn set_nrows(&mut self, nrows: usize)
pub unsafe fn set_nrows(&mut self, nrows: usize)
Set the dimensions of the matrix.
§Safety
The behavior is undefined if any of the following conditions are violated:
nrows < self.row_capacity()
.- The elements that were previously out of bounds but are now in bounds must be initialized.
Sourcepub fn as_ptr(&self) -> GroupFor<E, *const E::Unit>
pub fn as_ptr(&self) -> GroupFor<E, *const E::Unit>
Returns a pointer to the data of the matrix.
Sourcepub fn as_ptr_mut(&mut self) -> GroupFor<E, *mut E::Unit>
pub fn as_ptr_mut(&mut self) -> GroupFor<E, *mut E::Unit>
Returns a mutable pointer to the data of the matrix.
Sourcepub fn row_capacity(&self) -> usize
pub fn row_capacity(&self) -> usize
Returns the row capacity, that is, the number of rows that the matrix is able to hold without needing to reallocate, excluding column insertions.
Sourcepub fn row_stride(&self) -> isize
pub fn row_stride(&self) -> isize
Returns the offset between the first elements of two successive rows in the matrix.
Always returns 1
since the matrix is column major.
Sourcepub fn reserve_exact(&mut self, row_capacity: usize)
pub fn reserve_exact(&mut self, row_capacity: usize)
Reserves the minimum capacity for row_capacity
rows without reallocating. Does nothing if
the capacity is already sufficient.
§Panics
The function panics if the new total capacity in bytes exceeds isize::MAX
.
Sourcepub fn resize_with(&mut self, new_nrows: usize, f: impl FnMut(usize) -> E)
pub fn resize_with(&mut self, new_nrows: usize, f: impl FnMut(usize) -> E)
Resizes the vector in-place so that the new number of rows is new_nrows
.
New elements are created with the given function f
, so that elements at index i
are created by calling f(i)
.
Sourcepub fn as_slice(&self) -> GroupFor<E, &[E::Unit]>
pub fn as_slice(&self) -> GroupFor<E, &[E::Unit]>
Returns a reference to a slice over the column.
Sourcepub fn as_slice_mut(&mut self) -> GroupFor<E, &mut [E::Unit]>
pub fn as_slice_mut(&mut self) -> GroupFor<E, &mut [E::Unit]>
Returns a mutable reference to a slice over the column.
Sourcepub unsafe fn get_unchecked<RowRange>(
&self,
row: RowRange,
) -> <ColRef<'_, E> as ColIndex<RowRange>>::Target
pub unsafe fn get_unchecked<RowRange>( &self, row: RowRange, ) -> <ColRef<'_, E> as ColIndex<RowRange>>::Target
Returns references to the element at the given index, or submatrices if row
is a range.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Safety
The behavior is undefined if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.
Sourcepub fn get<RowRange>(
&self,
row: RowRange,
) -> <ColRef<'_, E> as ColIndex<RowRange>>::Target
pub fn get<RowRange>( &self, row: RowRange, ) -> <ColRef<'_, E> as ColIndex<RowRange>>::Target
Returns references to the element at the given index, or submatrices if row
is a range,
with bound checks.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Panics
The function panics if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.
Sourcepub unsafe fn get_mut_unchecked<RowRange>(
&mut self,
row: RowRange,
) -> <ColMut<'_, E> as ColIndex<RowRange>>::Target
pub unsafe fn get_mut_unchecked<RowRange>( &mut self, row: RowRange, ) -> <ColMut<'_, E> as ColIndex<RowRange>>::Target
Returns mutable references to the element at the given index, or submatrices if
row
is a range.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Safety
The behavior is undefined if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.
Sourcepub fn get_mut<RowRange>(
&mut self,
row: RowRange,
) -> <ColMut<'_, E> as ColIndex<RowRange>>::Target
pub fn get_mut<RowRange>( &mut self, row: RowRange, ) -> <ColMut<'_, E> as ColIndex<RowRange>>::Target
Returns mutable references to the element at the given index, or submatrices if
row
is a range, with bound checks.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Panics
The function panics if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.
Sourcepub unsafe fn read_unchecked(&self, row: usize) -> E
pub unsafe fn read_unchecked(&self, row: usize) -> E
Reads the value of the element at the given index.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.
Sourcepub fn read(&self, row: usize) -> E
pub fn read(&self, row: usize) -> E
Reads the value of the element at the given index, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
row < self.nrows()
.
Sourcepub unsafe fn write_unchecked(&mut self, row: usize, value: E)
pub unsafe fn write_unchecked(&mut self, row: usize, value: E)
Writes the value to the element at the given index.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.
Sourcepub fn write(&mut self, row: usize, value: E)
pub fn write(&mut self, row: usize, value: E)
Writes the value to the element at the given index, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
row < self.nrows()
.
Sourcepub fn fill_zero(&mut self)where
E: ComplexField,
pub fn fill_zero(&mut self)where
E: ComplexField,
Fills the elements of self
with zeros.
Sourcepub fn conjugate(&self) -> ColRef<'_, E::Conj>where
E: Conjugate,
pub fn conjugate(&self) -> ColRef<'_, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn adjoint(&self) -> RowRef<'_, E::Conj>where
E: Conjugate,
pub fn adjoint(&self) -> RowRef<'_, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Sourcepub fn to_owned(&self) -> Col<E::Canonical>where
E: Conjugate,
pub fn to_owned(&self) -> Col<E::Canonical>where
E: Conjugate,
Returns an owning Col
of the data
Sourcepub fn has_nan(&self) -> boolwhere
E: ComplexField,
pub fn has_nan(&self) -> boolwhere
E: ComplexField,
Returns true
if any of the elements is NaN, otherwise returns false
.
Sourcepub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
pub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
Returns true
if all of the elements are finite, otherwise returns false
.
Sourcepub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
Returns the maximum norm of self
.
Sourcepub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
Returns the L2 norm of self
.
Sourcepub fn sum(&self) -> Ewhere
E: ComplexField,
pub fn sum(&self) -> Ewhere
E: ComplexField,
Returns the sum of self
.
Source§impl<E: Entity> Matrix<DenseRowOwn<E>>
impl<E: Entity> Matrix<DenseRowOwn<E>>
Sourcepub fn with_capacity(col_capacity: usize) -> Self
pub fn with_capacity(col_capacity: usize) -> Self
Returns a new column vector with 0 columns, with enough capacity to hold a maximum of
col_capacity
columnss columns without reallocating. If col_capacity
is 0
,
the function will not allocate.
§Panics
The function panics if the total capacity in bytes exceeds isize::MAX
.
Sourcepub fn from_fn(ncols: usize, f: impl FnMut(usize) -> E) -> Self
pub fn from_fn(ncols: usize, f: impl FnMut(usize) -> E) -> Self
Returns a new matrix with number of columns ncols
, filled with the provided function.
§Panics
The function panics if the total capacity in bytes exceeds isize::MAX
.
Sourcepub fn zeros(ncols: usize) -> Selfwhere
E: ComplexField,
pub fn zeros(ncols: usize) -> Selfwhere
E: ComplexField,
Returns a new matrix with number of columns ncols
, filled with zeros.
§Panics
The function panics if the total capacity in bytes exceeds isize::MAX
.
Sourcepub unsafe fn set_ncols(&mut self, ncols: usize)
pub unsafe fn set_ncols(&mut self, ncols: usize)
Set the dimensions of the matrix.
§Safety
The behavior is undefined if any of the following conditions are violated:
ncols < self.col_capacity()
.- The elements that were previously out of bounds but are now in bounds must be initialized.
Sourcepub fn as_ptr(&self) -> GroupFor<E, *const E::Unit>
pub fn as_ptr(&self) -> GroupFor<E, *const E::Unit>
Returns a pointer to the data of the matrix.
Sourcepub fn as_ptr_mut(&mut self) -> GroupFor<E, *mut E::Unit>
pub fn as_ptr_mut(&mut self) -> GroupFor<E, *mut E::Unit>
Returns a mutable pointer to the data of the matrix.
Sourcepub fn col_capacity(&self) -> usize
pub fn col_capacity(&self) -> usize
Returns the col capacity, that is, the number of cols that the matrix is able to hold without needing to reallocate, excluding column insertions.
Sourcepub fn col_stride(&self) -> isize
pub fn col_stride(&self) -> isize
Returns the offset between the first elements of two successive columns in the matrix.
Always returns 1
since the matrix is column major.
Sourcepub fn reserve_exact(&mut self, col_capacity: usize)
pub fn reserve_exact(&mut self, col_capacity: usize)
Reserves the minimum capacity for col_capacity
columns without reallocating. Does nothing
if the capacity is already sufficient.
§Panics
The function panics if the new total capacity in bytes exceeds isize::MAX
.
Sourcepub fn resize_with(&mut self, new_ncols: usize, f: impl FnMut(usize) -> E)
pub fn resize_with(&mut self, new_ncols: usize, f: impl FnMut(usize) -> E)
Resizes the vector in-place so that the new number of columns is new_ncols
.
New elements are created with the given function f
, so that elements at index i
are created by calling f(i)
.
Sourcepub fn as_slice_mut(&mut self) -> GroupFor<E, &mut [E::Unit]>
pub fn as_slice_mut(&mut self) -> GroupFor<E, &mut [E::Unit]>
Returns a mutable reference to a slice over the row.
Sourcepub unsafe fn get_unchecked<ColRange>(
&self,
col: ColRange,
) -> <RowRef<'_, E> as RowIndex<ColRange>>::Target
pub unsafe fn get_unchecked<ColRange>( &self, col: ColRange, ) -> <RowRef<'_, E> as RowIndex<ColRange>>::Target
Returns references to the element at the given index, or submatrices if col
is a range.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Safety
The behavior is undefined if any of the following conditions are violated:
col
must be contained in[0, self.ncols())
.
Sourcepub fn get<ColRange>(
&self,
col: ColRange,
) -> <RowRef<'_, E> as RowIndex<ColRange>>::Target
pub fn get<ColRange>( &self, col: ColRange, ) -> <RowRef<'_, E> as RowIndex<ColRange>>::Target
Returns references to the element at the given index, or submatrices if col
is a range,
with bound checks.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Panics
The function panics if any of the following conditions are violated:
col
must be contained in[0, self.ncols())
.
Sourcepub unsafe fn get_mut_unchecked<ColRange>(
&mut self,
col: ColRange,
) -> <RowMut<'_, E> as RowIndex<ColRange>>::Target
pub unsafe fn get_mut_unchecked<ColRange>( &mut self, col: ColRange, ) -> <RowMut<'_, E> as RowIndex<ColRange>>::Target
Returns mutable references to the element at the given index, or submatrices if
col
is a range.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Safety
The behavior is undefined if any of the following conditions are violated:
col
must be contained in[0, self.ncols())
.
Sourcepub fn get_mut<ColRange>(
&mut self,
col: ColRange,
) -> <RowMut<'_, E> as RowIndex<ColRange>>::Target
pub fn get_mut<ColRange>( &mut self, col: ColRange, ) -> <RowMut<'_, E> as RowIndex<ColRange>>::Target
Returns mutable references to the element at the given index, or submatrices if
col
is a range, with bound checks.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Panics
The function panics if any of the following conditions are violated:
col
must be contained in[0, self.ncols())
.
Sourcepub unsafe fn read_unchecked(&self, col: usize) -> E
pub unsafe fn read_unchecked(&self, col: usize) -> E
Reads the value of the element at the given index.
§Safety
The behavior is undefined if any of the following conditions are violated:
col < self.ncols()
.
Sourcepub fn read(&self, col: usize) -> E
pub fn read(&self, col: usize) -> E
Reads the value of the element at the given index, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
col < self.ncols()
.
Sourcepub unsafe fn write_unchecked(&mut self, col: usize, value: E)
pub unsafe fn write_unchecked(&mut self, col: usize, value: E)
Writes the value to the element at the given index.
§Safety
The behavior is undefined if any of the following conditions are violated:
col < self.ncols()
.
Sourcepub fn write(&mut self, col: usize, value: E)
pub fn write(&mut self, col: usize, value: E)
Writes the value to the element at the given index, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
col < self.ncols()
.
Sourcepub fn fill_zero(&mut self)where
E: ComplexField,
pub fn fill_zero(&mut self)where
E: ComplexField,
Fills the elements of self
with zeros.
Sourcepub fn conjugate(&self) -> RowRef<'_, E::Conj>where
E: Conjugate,
pub fn conjugate(&self) -> RowRef<'_, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn adjoint(&self) -> ColRef<'_, E::Conj>where
E: Conjugate,
pub fn adjoint(&self) -> ColRef<'_, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Sourcepub fn to_owned(&self) -> Row<E::Canonical>where
E: Conjugate,
pub fn to_owned(&self) -> Row<E::Canonical>where
E: Conjugate,
Returns an owning Row
of the data
Sourcepub fn has_nan(&self) -> boolwhere
E: ComplexField,
pub fn has_nan(&self) -> boolwhere
E: ComplexField,
Returns true
if any of the elements is NaN, otherwise returns false
.
Sourcepub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
pub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
Returns true
if all of the elements are finite, otherwise returns false
.
Sourcepub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
Returns the maximum norm of self
.
Sourcepub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
Returns the L2 norm of self
.
Sourcepub fn sum(&self) -> Ewhere
E: ComplexField,
pub fn sum(&self) -> Ewhere
E: ComplexField,
Returns the sum of self
.
Source§impl<E: Entity> Matrix<DenseOwn<E>>
impl<E: Entity> Matrix<DenseOwn<E>>
Sourcepub fn with_capacity(row_capacity: usize, col_capacity: usize) -> Self
pub fn with_capacity(row_capacity: usize, col_capacity: usize) -> Self
Returns a new matrix with dimensions (0, 0)
, with enough capacity to hold a maximum of
row_capacity
rows and col_capacity
columns without reallocating. If either is 0
,
the matrix will not allocate.
§Panics
The function panics if the total capacity in bytes exceeds isize::MAX
.
Sourcepub fn from_fn(
nrows: usize,
ncols: usize,
f: impl FnMut(usize, usize) -> E,
) -> Self
pub fn from_fn( nrows: usize, ncols: usize, f: impl FnMut(usize, usize) -> E, ) -> Self
Returns a new matrix with dimensions (nrows, ncols)
, filled with the provided function.
§Panics
The function panics if the total capacity in bytes exceeds isize::MAX
.
Sourcepub fn zeros(nrows: usize, ncols: usize) -> Selfwhere
E: ComplexField,
pub fn zeros(nrows: usize, ncols: usize) -> Selfwhere
E: ComplexField,
Returns a new matrix with dimensions (nrows, ncols)
, filled with zeros.
§Panics
The function panics if the total capacity in bytes exceeds isize::MAX
.
Sourcepub fn identity(nrows: usize, ncols: usize) -> Selfwhere
E: ComplexField,
pub fn identity(nrows: usize, ncols: usize) -> Selfwhere
E: ComplexField,
Returns a new matrix with dimensions (nrows, ncols)
, filled with zeros, except the main
diagonal which is filled with ones.
§Panics
The function panics if the total capacity in bytes exceeds isize::MAX
.
Sourcepub unsafe fn set_dims(&mut self, nrows: usize, ncols: usize)
pub unsafe fn set_dims(&mut self, nrows: usize, ncols: usize)
Set the dimensions of the matrix.
§Safety
The behavior is undefined if any of the following conditions are violated:
nrows < self.row_capacity()
.ncols < self.col_capacity()
.- The elements that were previously out of bounds but are now in bounds must be initialized.
Sourcepub fn as_ptr(&self) -> GroupFor<E, *const E::Unit>
pub fn as_ptr(&self) -> GroupFor<E, *const E::Unit>
Returns a pointer to the data of the matrix.
Sourcepub fn as_ptr_mut(&mut self) -> GroupFor<E, *mut E::Unit>
pub fn as_ptr_mut(&mut self) -> GroupFor<E, *mut E::Unit>
Returns a mutable pointer to the data of the matrix.
Sourcepub fn row_capacity(&self) -> usize
pub fn row_capacity(&self) -> usize
Returns the row capacity, that is, the number of rows that the matrix is able to hold without needing to reallocate, excluding column insertions.
Sourcepub fn col_capacity(&self) -> usize
pub fn col_capacity(&self) -> usize
Returns the column capacity, that is, the number of columns that the matrix is able to hold without needing to reallocate, excluding row insertions.
Sourcepub fn row_stride(&self) -> isize
pub fn row_stride(&self) -> isize
Returns the offset between the first elements of two successive rows in the matrix.
Always returns 1
since the matrix is column major.
Sourcepub fn col_stride(&self) -> isize
pub fn col_stride(&self) -> isize
Returns the offset between the first elements of two successive columns in the matrix.
Sourcepub fn reserve_exact(&mut self, row_capacity: usize, col_capacity: usize)
pub fn reserve_exact(&mut self, row_capacity: usize, col_capacity: usize)
Reserves the minimum capacity for row_capacity
rows and col_capacity
columns without reallocating. Does nothing if the capacity is already sufficient.
§Panics
The function panics if the new total capacity in bytes exceeds isize::MAX
.
Sourcepub fn resize_with(
&mut self,
new_nrows: usize,
new_ncols: usize,
f: impl FnMut(usize, usize) -> E,
)
pub fn resize_with( &mut self, new_nrows: usize, new_ncols: usize, f: impl FnMut(usize, usize) -> E, )
Resizes the matrix in-place so that the new dimensions are (new_nrows, new_ncols)
.
New elements are created with the given function f
, so that elements at indices (i, j)
are created by calling f(i, j)
.
Sourcepub fn col_as_slice(&self, col: usize) -> GroupFor<E, &[E::Unit]>
pub fn col_as_slice(&self, col: usize) -> GroupFor<E, &[E::Unit]>
Returns a reference to a slice over the column at the given index.
Sourcepub fn col_as_slice_mut(&mut self, col: usize) -> GroupFor<E, &mut [E::Unit]>
pub fn col_as_slice_mut(&mut self, col: usize) -> GroupFor<E, &mut [E::Unit]>
Returns a mutable reference to a slice over the column at the given index.
Sourcepub fn col_ref(&self, col: usize) -> GroupFor<E, &[E::Unit]>
👎Deprecated: replaced by Mat::col_as_slice
pub fn col_ref(&self, col: usize) -> GroupFor<E, &[E::Unit]>
Mat::col_as_slice
Returns a reference to a slice over the column at the given index.
Sourcepub fn col_mut(&mut self, col: usize) -> GroupFor<E, &mut [E::Unit]>
👎Deprecated: replaced by Mat::col_as_slice_mut
pub fn col_mut(&mut self, col: usize) -> GroupFor<E, &mut [E::Unit]>
Mat::col_as_slice_mut
Returns a mutable reference to a slice over the column at the given index.
Sourcepub unsafe fn get_unchecked<RowRange, ColRange>(
&self,
row: RowRange,
col: ColRange,
) -> <MatRef<'_, E> as MatIndex<RowRange, ColRange>>::Target
pub unsafe fn get_unchecked<RowRange, ColRange>( &self, row: RowRange, col: ColRange, ) -> <MatRef<'_, E> as MatIndex<RowRange, ColRange>>::Target
Returns references to the element at the given indices, or submatrices if either row
or
col
is a range.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Safety
The behavior is undefined if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.col
must be contained in[0, self.ncols())
.
Sourcepub fn get<RowRange, ColRange>(
&self,
row: RowRange,
col: ColRange,
) -> <MatRef<'_, E> as MatIndex<RowRange, ColRange>>::Target
pub fn get<RowRange, ColRange>( &self, row: RowRange, col: ColRange, ) -> <MatRef<'_, E> as MatIndex<RowRange, ColRange>>::Target
Returns references to the element at the given indices, or submatrices if either row
or
col
is a range, with bound checks.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Panics
The function panics if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.col
must be contained in[0, self.ncols())
.
Sourcepub unsafe fn get_mut_unchecked<RowRange, ColRange>(
&mut self,
row: RowRange,
col: ColRange,
) -> <MatMut<'_, E> as MatIndex<RowRange, ColRange>>::Target
pub unsafe fn get_mut_unchecked<RowRange, ColRange>( &mut self, row: RowRange, col: ColRange, ) -> <MatMut<'_, E> as MatIndex<RowRange, ColRange>>::Target
Returns mutable references to the element at the given indices, or submatrices if either
row
or col
is a range.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Safety
The behavior is undefined if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.col
must be contained in[0, self.ncols())
.
Sourcepub fn get_mut<RowRange, ColRange>(
&mut self,
row: RowRange,
col: ColRange,
) -> <MatMut<'_, E> as MatIndex<RowRange, ColRange>>::Target
pub fn get_mut<RowRange, ColRange>( &mut self, row: RowRange, col: ColRange, ) -> <MatMut<'_, E> as MatIndex<RowRange, ColRange>>::Target
Returns mutable references to the element at the given indices, or submatrices if either
row
or col
is a range, with bound checks.
§Note
The values pointed to by the references are expected to be initialized, even if the pointed-to value is not read, otherwise the behavior is undefined.
§Panics
The function panics if any of the following conditions are violated:
row
must be contained in[0, self.nrows())
.col
must be contained in[0, self.ncols())
.
Sourcepub unsafe fn read_unchecked(&self, row: usize, col: usize) -> E
pub unsafe fn read_unchecked(&self, row: usize, col: usize) -> E
Reads the value of the element at the given indices.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.col < self.ncols()
.
Sourcepub fn read(&self, row: usize, col: usize) -> E
pub fn read(&self, row: usize, col: usize) -> E
Reads the value of the element at the given indices, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
row < self.nrows()
.col < self.ncols()
.
Sourcepub unsafe fn write_unchecked(&mut self, row: usize, col: usize, value: E)
pub unsafe fn write_unchecked(&mut self, row: usize, col: usize, value: E)
Writes the value to the element at the given indices.
§Safety
The behavior is undefined if any of the following conditions are violated:
row < self.nrows()
.col < self.ncols()
.
Sourcepub fn write(&mut self, row: usize, col: usize, value: E)
pub fn write(&mut self, row: usize, col: usize, value: E)
Writes the value to the element at the given indices, with bound checks.
§Panics
The function panics if any of the following conditions are violated:
row < self.nrows()
.col < self.ncols()
.
Sourcepub fn fill_zero(&mut self)where
E: ComplexField,
pub fn fill_zero(&mut self)where
E: ComplexField,
Fills the elements of self
with zeros.
Sourcepub fn conjugate(&self) -> MatRef<'_, E::Conj>where
E: Conjugate,
pub fn conjugate(&self) -> MatRef<'_, E::Conj>where
E: Conjugate,
Returns a view over the conjugate of self
.
Sourcepub fn adjoint(&self) -> MatRef<'_, E::Conj>where
E: Conjugate,
pub fn adjoint(&self) -> MatRef<'_, E::Conj>where
E: Conjugate,
Returns a view over the conjugate transpose of self
.
Sourcepub fn diagonal(&self) -> Matrix<DiagRef<'_, E>>
pub fn diagonal(&self) -> Matrix<DiagRef<'_, E>>
Returns a view over the diagonal of the matrix.
Sourcepub fn to_owned(&self) -> Mat<E::Canonical>where
E: Conjugate,
pub fn to_owned(&self) -> Mat<E::Canonical>where
E: Conjugate,
Returns an owning Mat
of the data
Sourcepub fn has_nan(&self) -> boolwhere
E: ComplexField,
pub fn has_nan(&self) -> boolwhere
E: ComplexField,
Returns true
if any of the elements is NaN, otherwise returns false
.
Sourcepub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
pub fn is_all_finite(&self) -> boolwhere
E: ComplexField,
Returns true
if all of the elements are finite, otherwise returns false
.
Sourcepub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_max(&self) -> E::Realwhere
E: ComplexField,
Returns the maximum norm of self
.
Sourcepub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
pub fn norm_l2(&self) -> E::Realwhere
E: ComplexField,
Returns the L2 norm of self
.
Sourcepub fn sum(&self) -> Ewhere
E: ComplexField,
pub fn sum(&self) -> Ewhere
E: ComplexField,
Returns the sum of self
.
Sourcepub fn kron(&self, rhs: impl As2D<E>) -> Mat<E>where
E: ComplexField,
pub fn kron(&self, rhs: impl As2D<E>) -> Mat<E>where
E: ComplexField,
Kroneckor product of self
and rhs
.
This is an allocating operation; see kron
for the
allocation-free version or more info in general.
Sourcepub fn col_chunks(
&self,
chunk_size: usize,
) -> impl '_ + DoubleEndedIterator<Item = MatRef<'_, E>>
pub fn col_chunks( &self, chunk_size: usize, ) -> impl '_ + DoubleEndedIterator<Item = MatRef<'_, E>>
Returns an iterator that provides successive chunks of the columns of a view over this
matrix, with each having at most chunk_size
columns.
If the number of columns is a multiple of chunk_size
, then all chunks have chunk_size
columns.
Sourcepub fn col_chunks_mut(
&mut self,
chunk_size: usize,
) -> impl '_ + DoubleEndedIterator<Item = MatMut<'_, E>>
pub fn col_chunks_mut( &mut self, chunk_size: usize, ) -> impl '_ + DoubleEndedIterator<Item = MatMut<'_, E>>
Returns an iterator that provides successive chunks of the columns of a mutable view over
this matrix, with each having at most chunk_size
columns.
If the number of columns is a multiple of chunk_size
, then all chunks have chunk_size
columns.
Sourcepub fn par_col_chunks(
&self,
chunk_size: usize,
) -> impl '_ + IndexedParallelIterator<Item = MatRef<'_, E>>
Available on crate feature rayon
only.
pub fn par_col_chunks( &self, chunk_size: usize, ) -> impl '_ + IndexedParallelIterator<Item = MatRef<'_, E>>
rayon
only.Returns a parallel iterator that provides successive chunks of the columns of a view over
this matrix, with each having at most chunk_size
columns.
If the number of columns is a multiple of chunk_size
, then all chunks have chunk_size
columns.
Only available with the rayon
feature.
Sourcepub fn par_col_chunks_mut(
&mut self,
chunk_size: usize,
) -> impl '_ + IndexedParallelIterator<Item = MatMut<'_, E>>
Available on crate feature rayon
only.
pub fn par_col_chunks_mut( &mut self, chunk_size: usize, ) -> impl '_ + IndexedParallelIterator<Item = MatMut<'_, E>>
rayon
only.Returns a parallel iterator that provides successive chunks of the columns of a mutable view
over this matrix, with each having at most chunk_size
columns.
If the number of columns is a multiple of chunk_size
, then all chunks have chunk_size
columns.
Only available with the rayon
feature.
Sourcepub fn row_chunks(
&self,
chunk_size: usize,
) -> impl '_ + DoubleEndedIterator<Item = MatRef<'_, E>>
pub fn row_chunks( &self, chunk_size: usize, ) -> impl '_ + DoubleEndedIterator<Item = MatRef<'_, E>>
Returns an iterator that provides successive chunks of the rows of a view over this
matrix, with each having at most chunk_size
rows.
If the number of rows is a multiple of chunk_size
, then all chunks have chunk_size
rows.
Sourcepub fn row_chunks_mut(
&mut self,
chunk_size: usize,
) -> impl '_ + DoubleEndedIterator<Item = MatMut<'_, E>>
pub fn row_chunks_mut( &mut self, chunk_size: usize, ) -> impl '_ + DoubleEndedIterator<Item = MatMut<'_, E>>
Returns an iterator that provides successive chunks of the rows of a mutable view over
this matrix, with each having at most chunk_size
rows.
If the number of rows is a multiple of chunk_size
, then all chunks have chunk_size
rows.
Sourcepub fn par_row_chunks(
&self,
chunk_size: usize,
) -> impl '_ + IndexedParallelIterator<Item = MatRef<'_, E>>
Available on crate feature rayon
only.
pub fn par_row_chunks( &self, chunk_size: usize, ) -> impl '_ + IndexedParallelIterator<Item = MatRef<'_, E>>
rayon
only.Returns a parallel iterator that provides successive chunks of the rows of a view over this
matrix, with each having at most chunk_size
rows.
If the number of rows is a multiple of chunk_size
, then all chunks have chunk_size
rows.
Only available with the rayon
feature.
Sourcepub fn par_row_chunks_mut(
&mut self,
chunk_size: usize,
) -> impl '_ + IndexedParallelIterator<Item = MatMut<'_, E>>
Available on crate feature rayon
only.
pub fn par_row_chunks_mut( &mut self, chunk_size: usize, ) -> impl '_ + IndexedParallelIterator<Item = MatMut<'_, E>>
rayon
only.Returns a parallel iterator that provides successive chunks of the rows of a mutable view
over this matrix, with each having at most chunk_size
rows.
If the number of rows is a multiple of chunk_size
, then all chunks have chunk_size
rows.
Only available with the rayon
feature.
Trait Implementations§
Source§impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Add<&Matrix<Rhs>> for &Matrix<Lhs>
impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Add<&Matrix<Rhs>> for &Matrix<Lhs>
Source§type Output = <<<Lhs as GenericMatrix>::Kind as MatAdd<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
type Output = <<<Lhs as GenericMatrix>::Kind as MatAdd<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
+
operator.Source§impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Add<&Matrix<Rhs>> for Matrix<Lhs>
impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Add<&Matrix<Rhs>> for Matrix<Lhs>
Source§type Output = <<<Lhs as GenericMatrix>::Kind as MatAdd<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
type Output = <<<Lhs as GenericMatrix>::Kind as MatAdd<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
+
operator.Source§impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Add<Matrix<Rhs>> for &Matrix<Lhs>
impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Add<Matrix<Rhs>> for &Matrix<Lhs>
Source§type Output = <<<Lhs as GenericMatrix>::Kind as MatAdd<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
type Output = <<<Lhs as GenericMatrix>::Kind as MatAdd<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
+
operator.Source§impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Add<Matrix<Rhs>> for Matrix<Lhs>
impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Add<Matrix<Rhs>> for Matrix<Lhs>
Source§type Output = <<<Lhs as GenericMatrix>::Kind as MatAdd<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
type Output = <<<Lhs as GenericMatrix>::Kind as MatAdd<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
+
operator.Source§impl<Lhs: GenericMatrixMut, Rhs: GenericMatrix> AddAssign<&Matrix<Rhs>> for Matrix<Lhs>where
Lhs::Elem: ComplexField,
Rhs::Elem: Conjugate<Canonical = Lhs::Elem>,
Lhs::Kind: MatAddAssign<Rhs::Kind>,
impl<Lhs: GenericMatrixMut, Rhs: GenericMatrix> AddAssign<&Matrix<Rhs>> for Matrix<Lhs>where
Lhs::Elem: ComplexField,
Rhs::Elem: Conjugate<Canonical = Lhs::Elem>,
Lhs::Kind: MatAddAssign<Rhs::Kind>,
Source§fn add_assign(&mut self, rhs: &Matrix<Rhs>)
fn add_assign(&mut self, rhs: &Matrix<Rhs>)
+=
operation. Read moreSource§impl<Lhs: GenericMatrixMut, Rhs: GenericMatrix> AddAssign<Matrix<Rhs>> for Matrix<Lhs>where
Lhs::Elem: ComplexField,
Rhs::Elem: Conjugate<Canonical = Lhs::Elem>,
Lhs::Kind: MatAddAssign<Rhs::Kind>,
impl<Lhs: GenericMatrixMut, Rhs: GenericMatrix> AddAssign<Matrix<Rhs>> for Matrix<Lhs>where
Lhs::Elem: ComplexField,
Rhs::Elem: Conjugate<Canonical = Lhs::Elem>,
Lhs::Kind: MatAddAssign<Rhs::Kind>,
Source§fn add_assign(&mut self, rhs: Matrix<Rhs>)
fn add_assign(&mut self, rhs: Matrix<Rhs>)
+=
operation. Read moreSource§impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Mul<&Matrix<Rhs>> for &Matrix<Lhs>
impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Mul<&Matrix<Rhs>> for &Matrix<Lhs>
Source§type Output = <<<Lhs as GenericMatrix>::Kind as MatMul<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
type Output = <<<Lhs as GenericMatrix>::Kind as MatMul<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
*
operator.Source§impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Mul<&Matrix<Rhs>> for Matrix<Lhs>
impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Mul<&Matrix<Rhs>> for Matrix<Lhs>
Source§type Output = <<<Lhs as GenericMatrix>::Kind as MatMul<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
type Output = <<<Lhs as GenericMatrix>::Kind as MatMul<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
*
operator.Source§impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Mul<Matrix<Rhs>> for &Matrix<Lhs>
impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Mul<Matrix<Rhs>> for &Matrix<Lhs>
Source§type Output = <<<Lhs as GenericMatrix>::Kind as MatMul<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
type Output = <<<Lhs as GenericMatrix>::Kind as MatMul<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
*
operator.Source§impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Mul<Matrix<Rhs>> for Matrix<Lhs>
impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Mul<Matrix<Rhs>> for Matrix<Lhs>
Source§type Output = <<<Lhs as GenericMatrix>::Kind as MatMul<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
type Output = <<<Lhs as GenericMatrix>::Kind as MatMul<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
*
operator.Source§impl<Lhs: GenericMatrixMut, Rhs: GenericMatrix> MulAssign<&Matrix<Rhs>> for Matrix<Lhs>where
Lhs::Elem: ComplexField,
Rhs::Elem: Conjugate<Canonical = Lhs::Elem>,
Lhs::Kind: MatMulAssign<Rhs::Kind>,
impl<Lhs: GenericMatrixMut, Rhs: GenericMatrix> MulAssign<&Matrix<Rhs>> for Matrix<Lhs>where
Lhs::Elem: ComplexField,
Rhs::Elem: Conjugate<Canonical = Lhs::Elem>,
Lhs::Kind: MatMulAssign<Rhs::Kind>,
Source§fn mul_assign(&mut self, rhs: &Matrix<Rhs>)
fn mul_assign(&mut self, rhs: &Matrix<Rhs>)
*=
operation. Read moreSource§impl<Lhs: GenericMatrixMut, Rhs: GenericMatrix> MulAssign<Matrix<Rhs>> for Matrix<Lhs>where
Lhs::Elem: ComplexField,
Rhs::Elem: Conjugate<Canonical = Lhs::Elem>,
Lhs::Kind: MatMulAssign<Rhs::Kind>,
impl<Lhs: GenericMatrixMut, Rhs: GenericMatrix> MulAssign<Matrix<Rhs>> for Matrix<Lhs>where
Lhs::Elem: ComplexField,
Rhs::Elem: Conjugate<Canonical = Lhs::Elem>,
Lhs::Kind: MatMulAssign<Rhs::Kind>,
Source§fn mul_assign(&mut self, rhs: Matrix<Rhs>)
fn mul_assign(&mut self, rhs: Matrix<Rhs>)
*=
operation. Read moreSource§impl<Mat: GenericMatrix> Neg for &Matrix<Mat>
impl<Mat: GenericMatrix> Neg for &Matrix<Mat>
Source§impl<Mat: GenericMatrix> Neg for Matrix<Mat>
impl<Mat: GenericMatrix> Neg for Matrix<Mat>
Source§impl<Lhs: GenericMatrix, Rhs: GenericMatrix> PartialEq<Matrix<Rhs>> for Matrix<Lhs>
impl<Lhs: GenericMatrix, Rhs: GenericMatrix> PartialEq<Matrix<Rhs>> for Matrix<Lhs>
Source§impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Sub<&Matrix<Rhs>> for &Matrix<Lhs>
impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Sub<&Matrix<Rhs>> for &Matrix<Lhs>
Source§type Output = <<<Lhs as GenericMatrix>::Kind as MatSub<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
type Output = <<<Lhs as GenericMatrix>::Kind as MatSub<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
-
operator.Source§impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Sub<&Matrix<Rhs>> for Matrix<Lhs>
impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Sub<&Matrix<Rhs>> for Matrix<Lhs>
Source§type Output = <<<Lhs as GenericMatrix>::Kind as MatSub<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
type Output = <<<Lhs as GenericMatrix>::Kind as MatSub<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
-
operator.Source§impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Sub<Matrix<Rhs>> for &Matrix<Lhs>
impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Sub<Matrix<Rhs>> for &Matrix<Lhs>
Source§type Output = <<<Lhs as GenericMatrix>::Kind as MatSub<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
type Output = <<<Lhs as GenericMatrix>::Kind as MatSub<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
-
operator.Source§impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Sub<Matrix<Rhs>> for Matrix<Lhs>
impl<Lhs: GenericMatrix, Rhs: GenericMatrix> Sub<Matrix<Rhs>> for Matrix<Lhs>
Source§type Output = <<<Lhs as GenericMatrix>::Kind as MatSub<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
type Output = <<<Lhs as GenericMatrix>::Kind as MatSub<<Rhs as GenericMatrix>::Kind>>::Output as MatrixKind>::Own<<<Lhs as GenericMatrix>::Elem as Conjugate>::Canonical>
-
operator.Source§impl<Lhs: GenericMatrixMut, Rhs: GenericMatrix> SubAssign<&Matrix<Rhs>> for Matrix<Lhs>where
Lhs::Elem: ComplexField,
Rhs::Elem: Conjugate<Canonical = Lhs::Elem>,
Lhs::Kind: MatSubAssign<Rhs::Kind>,
impl<Lhs: GenericMatrixMut, Rhs: GenericMatrix> SubAssign<&Matrix<Rhs>> for Matrix<Lhs>where
Lhs::Elem: ComplexField,
Rhs::Elem: Conjugate<Canonical = Lhs::Elem>,
Lhs::Kind: MatSubAssign<Rhs::Kind>,
Source§fn sub_assign(&mut self, rhs: &Matrix<Rhs>)
fn sub_assign(&mut self, rhs: &Matrix<Rhs>)
-=
operation. Read moreSource§impl<Lhs: GenericMatrixMut, Rhs: GenericMatrix> SubAssign<Matrix<Rhs>> for Matrix<Lhs>where
Lhs::Elem: ComplexField,
Rhs::Elem: Conjugate<Canonical = Lhs::Elem>,
Lhs::Kind: MatSubAssign<Rhs::Kind>,
impl<Lhs: GenericMatrixMut, Rhs: GenericMatrix> SubAssign<Matrix<Rhs>> for Matrix<Lhs>where
Lhs::Elem: ComplexField,
Rhs::Elem: Conjugate<Canonical = Lhs::Elem>,
Lhs::Kind: MatSubAssign<Rhs::Kind>,
Source§fn sub_assign(&mut self, rhs: Matrix<Rhs>)
fn sub_assign(&mut self, rhs: Matrix<Rhs>)
-=
operation. Read moreimpl<M: Copy> Copy for Matrix<M>
Auto Trait Implementations§
impl<M> Freeze for Matrix<M>where
M: Freeze,
impl<M> RefUnwindSafe for Matrix<M>where
M: RefUnwindSafe,
impl<M> Send for Matrix<M>where
M: Send,
impl<M> Sync for Matrix<M>where
M: Sync,
impl<M> Unpin for Matrix<M>where
M: Unpin,
impl<M> UnwindSafe for Matrix<M>where
M: 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
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>
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>
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