Trait nannou::math::Matrix[][src]

pub trait Matrix: VectorSpace + Index<usize, Output = Self::Column, Output = Self::Column> + IndexMut<usize> + AbsDiffEq<Self, Epsilon = Self::Scalar, Epsilon = Self::Scalar, Epsilon = Self::Scalar> + RelativeEq<Self> + UlpsEq<Self> where
    Self::Scalar: BaseFloat
{ type Row: VectorSpace + Array; type Column: VectorSpace + Array; type Transpose: Matrix; pub fn row(&self, r: usize) -> Self::Row;
pub fn swap_rows(&mut self, a: usize, b: usize);
pub fn swap_columns(&mut self, a: usize, b: usize);
pub fn swap_elements(&mut self, a: (usize, usize), b: (usize, usize));
pub fn transpose(&self) -> Self::Transpose; pub fn as_ptr(&self) -> *const Self::Scalar { ... }
pub fn as_mut_ptr(&mut self) -> *mut Self::Scalar { ... }
pub fn replace_col(&mut self, c: usize, src: Self::Column) -> Self::Column { ... } }

A column-major matrix of arbitrary dimensions.

Because this is constrained to the VectorSpace trait, this means that following operators are required to be implemented:

Matrix addition:

  • Add<Output = Self>
  • Sub<Output = Self>
  • Neg<Output = Self>

Scalar multiplication:

  • Mul<Self::Scalar, Output = Self>
  • Div<Self::Scalar, Output = Self>
  • Rem<Self::Scalar, Output = Self>

Note that matrix multiplication is not required for implementors of this trait. This is due to the complexities of implementing these operators with Rust’s current type system. For the multiplication of square matrices, see SquareMatrix.

Associated Types

type Row: VectorSpace + Array[src]

The row vector of the matrix.

type Column: VectorSpace + Array[src]

The column vector of the matrix.

type Transpose: Matrix[src]

The result of transposing the matrix

Loading content...

Required methods

pub fn row(&self, r: usize) -> Self::Row[src]

Get a row from this matrix by-value.

pub fn swap_rows(&mut self, a: usize, b: usize)[src]

Swap two rows of this array.

pub fn swap_columns(&mut self, a: usize, b: usize)[src]

Swap two columns of this array.

pub fn swap_elements(&mut self, a: (usize, usize), b: (usize, usize))[src]

Swap the values at index a and b

pub fn transpose(&self) -> Self::Transpose[src]

Transpose this matrix, returning a new matrix.

Loading content...

Provided methods

pub fn as_ptr(&self) -> *const Self::Scalar[src]

Get the pointer to the first element of the array.

pub fn as_mut_ptr(&mut self) -> *mut Self::Scalar[src]

Get a mutable pointer to the first element of the array.

pub fn replace_col(&mut self, c: usize, src: Self::Column) -> Self::Column[src]

Replace a column in the array.

Loading content...

Implementors

impl<S> Matrix for Matrix2<S> where
    S: BaseFloat
[src]

type Column = Vector2<S>

type Row = Vector2<S>

type Transpose = Matrix2<S>

impl<S> Matrix for Matrix3<S> where
    S: BaseFloat
[src]

type Column = Vector3<S>

type Row = Vector3<S>

type Transpose = Matrix3<S>

impl<S> Matrix for Matrix4<S> where
    S: BaseFloat
[src]

type Column = Vector4<S>

type Row = Vector4<S>

type Transpose = Matrix4<S>

Loading content...