pub struct Matrix<T>(pub Vec<Vec<T>>)
where
T: Clone + Copy + Add<Output = T> + Sub<Output = T> + Mul<Output = T> + AddAssign + SubAssign + From<i32>;Tuple Fields§
§0: Vec<Vec<T>>Implementations§
Source§impl<T> Matrix<T>
impl<T> Matrix<T>
Sourcepub fn transpose(&self) -> Self
pub fn transpose(&self) -> Self
Returns a transposed matrix of the original matrix.
use rustrix::*;
let m1 = mx![
1, 2, 3;
4, 5, 6;
];
let m2 = mx![
1, 4;
2, 5;
3, 6;
];
assert_eq!(m1.transpose(), m2);Sourcepub fn dot_prod(m1: Self, m2: Self) -> Self
👎Deprecated since 0.2.0: Please use ‘*’ operator instead.
pub fn dot_prod(m1: Self, m2: Self) -> Self
Performs the matrix dot product operation.
Sourcepub fn mul_scalar(&self, scalar: T) -> Self
pub fn mul_scalar(&self, scalar: T) -> Self
Performs scalar multiplication to the matrix.
use rustrix::*;
let m1 = mx![
1, 2, 3;
4, 5, 6;
];
let m2 = mx![
2, 4, 6;
8, 10, 12;
];
assert_eq!(m1.mul_scalar(2), m2);Trait Implementations§
impl<T> StructuralPartialEq for Matrix<T>
Auto Trait Implementations§
impl<T> Freeze for Matrix<T>
impl<T> RefUnwindSafe for Matrix<T>where
T: RefUnwindSafe,
impl<T> Send for Matrix<T>where
T: Send,
impl<T> Sync for Matrix<T>where
T: Sync,
impl<T> Unpin for Matrix<T>where
T: Unpin,
impl<T> UnwindSafe for Matrix<T>where
T: 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
Mutably borrows from an owned value. Read more