Struct matmath::matrix_class::Matrix [−][src]
pub struct Matrix<T> { /* fields omitted */ }
A Matrix with generic type items.
Can be indexed by mat[(row, col)]
Methods
impl<T> Matrix<T>
[src]
impl<T> Matrix<T>
pub fn fill(rows: usize, cols: usize, e: T) -> Self where
T: Clone,
[src]
pub fn fill(rows: usize, cols: usize, e: T) -> Self where
T: Clone,
Generates a rows
xcols
matrix where every element is e
pub fn build<F>(rows: usize, cols: usize, builder_fn: F) -> Self where
F: Fn(usize, usize) -> T,
[src]
pub fn build<F>(rows: usize, cols: usize, builder_fn: F) -> Self where
F: Fn(usize, usize) -> T,
Generates a rows
xcols
matrix where every element is obtained by evaluating builder_fn(row, col)
pub fn identity(rows: usize) -> Self where
T: MatrixElement,
[src]
pub fn identity(rows: usize) -> Self where
T: MatrixElement,
Generates a rows
xrows
identity matrix (using MatrixElement::zero()
and MatrixElement::one()
)
pub fn from_vec(rows: usize, cols: usize, data: Vec<T>) -> Self
[src]
pub fn from_vec(rows: usize, cols: usize, data: Vec<T>) -> Self
Generates a rows
xcols
matrix with the data specified in data
impl<T> Matrix<T>
[src]
impl<T> Matrix<T>
pub fn rows(&self) -> usize
[src]
pub fn rows(&self) -> usize
pub fn cols(&self) -> usize
[src]
pub fn cols(&self) -> usize
pub fn dim(&self) -> (usize, usize)
[src]
pub fn dim(&self) -> (usize, usize)
pub fn area(&self) -> usize
[src]
pub fn area(&self) -> usize
pub fn dump(self) -> (usize, usize, Vec<T>)
[src]
pub fn dump(self) -> (usize, usize, Vec<T>)
pub fn get_at(&self, row: usize, col: usize) -> Result<T, String> where
T: Clone,
[src]
pub fn get_at(&self, row: usize, col: usize) -> Result<T, String> where
T: Clone,
pub fn set_at(&mut self, row: usize, col: usize, val: T) -> Result<(), String> where
T: Clone,
[src]
pub fn set_at(&mut self, row: usize, col: usize, val: T) -> Result<(), String> where
T: Clone,
pub fn map<F, U>(self, f: F) -> Matrix<U> where
F: Fn(T) -> U,
[src]
pub fn map<F, U>(self, f: F) -> Matrix<U> where
F: Fn(T) -> U,
pub fn transposed(self) -> Self
[src]
pub fn transposed(self) -> Self
pub fn det(self) -> T where
T: Add<T, Output = T> + Sub<T, Output = T> + MatrixElement + Clone + Mul<Output = T>,
[src]
pub fn det(self) -> T where
T: Add<T, Output = T> + Sub<T, Output = T> + MatrixElement + Clone + Mul<Output = T>,
pub fn scaled<U, O>(self, scalar: U) -> Matrix<O> where
U: Mul<T, Output = O>,
U: Clone,
[src]
pub fn scaled<U, O>(self, scalar: U) -> Matrix<O> where
U: Mul<T, Output = O>,
U: Clone,
Multiplies the matrix with a scalar
impl Matrix<RotmatElement>
[src]
impl Matrix<RotmatElement>
pub fn insert_rotation_value<T, O>(self, value: T) -> Matrix<O> where
T: Trig<Output = O> + Clone,
O: Neg<Output = O> + Add<Output = O> + Mul<Output = O> + MatrixElement,
[src]
pub fn insert_rotation_value<T, O>(self, value: T) -> Matrix<O> where
T: Trig<Output = O> + Clone,
O: Neg<Output = O> + Add<Output = O> + Mul<Output = O> + MatrixElement,
Takes a previously generated Rotation Matrix and inserts a specific value into it
For f32 and f64, this would be the angle in radians, but for your own type it could be whatever...
(it uses the Trig
and the MatrixElement
traits to get values for sin, -sin, cos, 0 and 1)
Trait Implementations
impl<T: Debug> Debug for Matrix<T>
[src]
impl<T: Debug> Debug for Matrix<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: Clone> Clone for Matrix<T>
[src]
impl<T: Clone> Clone for Matrix<T>
fn clone(&self) -> Matrix<T>
[src]
fn clone(&self) -> Matrix<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: PartialEq> PartialEq for Matrix<T>
[src]
impl<T: PartialEq> PartialEq for Matrix<T>
fn eq(&self, other: &Matrix<T>) -> bool
[src]
fn eq(&self, other: &Matrix<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Matrix<T>) -> bool
[src]
fn ne(&self, other: &Matrix<T>) -> bool
This method tests for !=
.
impl<T: Eq> Eq for Matrix<T>
[src]
impl<T: Eq> Eq for Matrix<T>
impl<T> Display for Matrix<T> where
T: Display + Clone,
[src]
impl<T> Display for Matrix<T> where
T: Display + Clone,
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T> Index<(usize, usize)> for Matrix<T>
[src]
impl<T> Index<(usize, usize)> for Matrix<T>
type Output = T
The returned type after indexing.
fn index(&self, (row, col): (usize, usize)) -> &T
[src]
fn index(&self, (row, col): (usize, usize)) -> &T
Performs the indexing (container[index]
) operation.
impl<T> IndexMut<(usize, usize)> for Matrix<T>
[src]
impl<T> IndexMut<(usize, usize)> for Matrix<T>
fn index_mut(&mut self, (row, col): (usize, usize)) -> &mut T
[src]
fn index_mut(&mut self, (row, col): (usize, usize)) -> &mut T
Performs the mutable indexing (container[index]
) operation.
impl<T, U, O> Add<Matrix<U>> for Matrix<T> where
T: Add<U, Output = O>,
[src]
impl<T, U, O> Add<Matrix<U>> for Matrix<T> where
T: Add<U, Output = O>,
Adds two matrices element by element
type Output = Matrix<O>
The resulting type after applying the +
operator.
fn add(self, rhs: Matrix<U>) -> Matrix<O>
[src]
fn add(self, rhs: Matrix<U>) -> Matrix<O>
Performs the +
operation.
impl<T, U, O> Sub<Matrix<U>> for Matrix<T> where
T: Clone + Sub<U, Output = O>,
U: Clone,
[src]
impl<T, U, O> Sub<Matrix<U>> for Matrix<T> where
T: Clone + Sub<U, Output = O>,
U: Clone,
Subtracts two matrices element by element
type Output = Matrix<O>
The resulting type after applying the -
operator.
fn sub(self, rhs: Matrix<U>) -> Matrix<O>
[src]
fn sub(self, rhs: Matrix<U>) -> Matrix<O>
Performs the -
operation.
impl<T, U, O> Mul<Matrix<U>> for Matrix<T> where
T: Mul<U, Output = O> + Clone,
U: Clone,
O: Add<O, Output = O>,
[src]
impl<T, U, O> Mul<Matrix<U>> for Matrix<T> where
T: Mul<U, Output = O> + Clone,
U: Clone,
O: Add<O, Output = O>,
Matrix Multiplication
type Output = Matrix<O>
The resulting type after applying the *
operator.
fn mul(self, rhs: Matrix<U>) -> Matrix<O>
[src]
fn mul(self, rhs: Matrix<U>) -> Matrix<O>
Performs the *
operation.
impl<T, U, O> Mul<Vector<U>> for Matrix<T> where
T: Mul<U, Output = O> + Clone,
U: Clone,
O: Add<O, Output = O>,
[src]
impl<T, U, O> Mul<Vector<U>> for Matrix<T> where
T: Mul<U, Output = O> + Clone,
U: Clone,
O: Add<O, Output = O>,
Matrix-Vector Multiplication
type Output = Vector<O>
The resulting type after applying the *
operator.
fn mul(self, rhs: Vector<U>) -> Vector<O>
[src]
fn mul(self, rhs: Vector<U>) -> Vector<O>
Performs the *
operation.
impl<T, O> Neg for Matrix<T> where
T: Neg<Output = O>,
[src]
impl<T, O> Neg for Matrix<T> where
T: Neg<Output = O>,
type Output = Matrix<O>
The resulting type after applying the -
operator.
fn neg(self) -> Matrix<O>
[src]
fn neg(self) -> Matrix<O>
Performs the unary -
operation.
impl<T, U, O> Rem<U> for Matrix<T> where
T: Rem<U, Output = O>,
U: Clone,
[src]
impl<T, U, O> Rem<U> for Matrix<T> where
T: Rem<U, Output = O>,
U: Clone,
type Output = Matrix<O>
The resulting type after applying the %
operator.
fn rem(self, rhs: U) -> Matrix<O>
[src]
fn rem(self, rhs: U) -> Matrix<O>
Performs the %
operation.
impl<T, U, O> BitAnd<U> for Matrix<T> where
T: BitAnd<U, Output = O>,
U: Clone,
[src]
impl<T, U, O> BitAnd<U> for Matrix<T> where
T: BitAnd<U, Output = O>,
U: Clone,
type Output = Matrix<O>
The resulting type after applying the &
operator.
fn bitand(self, rhs: U) -> Matrix<O>
[src]
fn bitand(self, rhs: U) -> Matrix<O>
Performs the &
operation.
impl<T, U, O> BitOr<U> for Matrix<T> where
T: BitOr<U, Output = O>,
U: Clone,
[src]
impl<T, U, O> BitOr<U> for Matrix<T> where
T: BitOr<U, Output = O>,
U: Clone,
type Output = Matrix<O>
The resulting type after applying the |
operator.
fn bitor(self, rhs: U) -> Matrix<O>
[src]
fn bitor(self, rhs: U) -> Matrix<O>
Performs the |
operation.
impl<T, U, O> BitXor<U> for Matrix<T> where
T: BitXor<U, Output = O>,
U: Clone,
[src]
impl<T, U, O> BitXor<U> for Matrix<T> where
T: BitXor<U, Output = O>,
U: Clone,
type Output = Matrix<O>
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: U) -> Matrix<O>
[src]
fn bitxor(self, rhs: U) -> Matrix<O>
Performs the ^
operation.
impl<T, O> Not for Matrix<T> where
T: Not<Output = O>,
[src]
impl<T, O> Not for Matrix<T> where
T: Not<Output = O>,
type Output = Matrix<O>
The resulting type after applying the !
operator.
fn not(self) -> Matrix<O>
[src]
fn not(self) -> Matrix<O>
Performs the unary !
operation.
impl<T, U, O> Shl<U> for Matrix<T> where
T: Shl<U, Output = O>,
U: Clone,
[src]
impl<T, U, O> Shl<U> for Matrix<T> where
T: Shl<U, Output = O>,
U: Clone,
type Output = Matrix<O>
The resulting type after applying the <<
operator.
fn shl(self, rhs: U) -> Matrix<O>
[src]
fn shl(self, rhs: U) -> Matrix<O>
Performs the <<
operation.
impl<T, U, O> Shr<U> for Matrix<T> where
T: Shr<U, Output = O>,
U: Clone,
[src]
impl<T, U, O> Shr<U> for Matrix<T> where
T: Shr<U, Output = O>,
U: Clone,
type Output = Matrix<O>
The resulting type after applying the >>
operator.
fn shr(self, rhs: U) -> Matrix<O>
[src]
fn shr(self, rhs: U) -> Matrix<O>
Performs the >>
operation.
impl<T> Into<Matrix<T>> for Vector<T>
[src]
impl<T> Into<Matrix<T>> for Vector<T>
A Vector can be cast to a matrix and back
impl<T> From<Matrix<T>> for Vector<T>
[src]
impl<T> From<Matrix<T>> for Vector<T>
A Vector can be cast to a matrix and back
impl<T> Into<Matrix<T>> for Vector2<T>
[src]
impl<T> Into<Matrix<T>> for Vector2<T>
A Vector can be cast to a matrix and back
impl<T> From<Matrix<T>> for Vector2<T> where
T: Clone,
[src]
impl<T> From<Matrix<T>> for Vector2<T> where
T: Clone,
A Vector can be cast to a matrix and back
impl<T> Into<Matrix<T>> for Vector3<T>
[src]
impl<T> Into<Matrix<T>> for Vector3<T>
impl<T> From<Matrix<T>> for Vector3<T> where
T: Clone,
[src]
impl<T> From<Matrix<T>> for Vector3<T> where
T: Clone,
impl<T> Into<Matrix<T>> for Vector4<T>
[src]
impl<T> Into<Matrix<T>> for Vector4<T>
impl<T> From<Matrix<T>> for Vector4<T> where
T: Clone,
[src]
impl<T> From<Matrix<T>> for Vector4<T> where
T: Clone,