Struct matrixable::strategies::Transpose
source · pub struct Transpose;
Expand description
Performs matrix transposition.
§Example
use matrixable::MatrixExt;
use matrixable::strategies::{ TransformStrategy, Transpose };
let m = [
[ 0, 1 ],
[ 2, 3 ],
[ 4, 5 ]
];
let expected = [
[ 0, 2, 4 ],
[ 1, 3, 5 ]
];
// `m` is borrowed
let access = m.access(Transpose);
assert!(expected.iter().eq(access.iter()));
// `m` is consumed.
let t = Transpose.out_of(m);
assert_eq!(expected, t);
Implementations§
source§impl Transpose
impl Transpose
sourcepub fn in_place_square<M: MatrixMutExt>(&self, m: &mut M)
pub fn in_place_square<M: MatrixMutExt>(&self, m: &mut M)
In-place transposition optimized for square matrices.
§Panics
Panics if the matrix is not a square matrix.
sourcepub fn in_place<M: SwapsDimensions + MatrixMutExt>(&self, m: &mut M)
pub fn in_place<M: SwapsDimensions + MatrixMutExt>(&self, m: &mut M)
Performs a regular in-place Transposition.
Trait Implementations§
source§impl<M: MatrixExt> AccessStrategy<M> for Transpose
impl<M: MatrixExt> AccessStrategy<M> for Transpose
source§fn access(&self, _m: &M, i: usize, j: usize) -> Option<(usize, usize)>
fn access(&self, _m: &M, i: usize, j: usize) -> Option<(usize, usize)>
Gives the location (if it exists) of the element in a matrix that
should match the indexes (subscripts) provided according to the access strategy. Read more
source§impl Ord for Transpose
impl Ord for Transpose
source§impl PartialEq for Transpose
impl PartialEq for Transpose
source§impl PartialOrd for Transpose
impl PartialOrd for Transpose
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<T: Default + Copy, const N: usize, const M: usize> TransformStrategy<[[T; N]; M]> for Transpose
impl<T: Default + Copy, const N: usize, const M: usize> TransformStrategy<[[T; N]; M]> for Transpose
source§impl<M: SwapsDimensions + MatrixMutExt> TransformStrategy<M> for Transpose
impl<M: SwapsDimensions + MatrixMutExt> TransformStrategy<M> for Transpose
impl Copy for Transpose
impl Eq for Transpose
impl StructuralPartialEq for Transpose
Auto Trait Implementations§
impl RefUnwindSafe for Transpose
impl Send for Transpose
impl Sync for Transpose
impl Unpin for Transpose
impl UnwindSafe for Transpose
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
Mutably borrows from an owned value. Read more