Struct rusty_machine::prelude::Matrix []

pub struct Matrix<T> { /* fields omitted */ }

The Matrix struct.

Can be instantiated with any type.

Methods

impl<T> Matrix<T> where T: Any + Float

Compute the QR decomposition of the matrix.

Returns the tuple (Q,R).

Examples

use rulinalg::matrix::Matrix;

let m = Matrix::new(3,3, vec![1.0,0.5,0.5,0.5,1.0,0.5,0.5,0.5,1.0]);

let (q, r) = m.qr_decomp().unwrap();

Failures

  • Cannot compute the QR decomposition.

impl<T> Matrix<T> where T: Any + Float

Cholesky decomposition

Returns the cholesky decomposition of a positive definite matrix.

Examples

use rulinalg::matrix::Matrix;

let m = Matrix::new(3,3, vec![1.0,0.5,0.5,0.5,1.0,0.5,0.5,0.5,1.0]);

let l = m.cholesky();

Panics

  • The matrix is not square.

Failures

  • Matrix is not positive definite.

impl<T> Matrix<T> where T: Any + Float

Converts matrix to bidiagonal form

Returns (B, U, V), where B is bidiagonal and self = U B V_T.

Note that if self has self.rows() > self.cols() the matrix will be transposed and then reduced - this will lead to a sub-diagonal instead of super-diagonal.

Failures

  • The matrix cannot be reduced to bidiagonal form.

impl<T> Matrix<T> where T: Any + Signed + Float

Singular Value Decomposition

Computes the SVD using the Golub-Reinsch algorithm.

Returns Σ, U, V, such that self = U Σ VT. Σ is a diagonal matrix whose elements correspond to the non-negative singular values of the matrix. The singular values are ordered in non-increasing order. U and V have orthonormal columns, and each column represents the left and right singular vectors for the corresponding singular value in Σ, respectively.

If self has M rows and N columns, the dimensions of the returned matrices are as follows.

If M >= N:

  • Σ: N x N
  • U: M x N
  • V: N x N

If M < N:

  • Σ: M x M
  • U: M x M
  • V: N x M

Note: This version of the SVD is sometimes referred to as the 'economy SVD'.

Failures

This function may fail in some cases. The current decomposition whilst being efficient is fairly basic. Hopefully the algorithm can be made not to fail in the near future.

impl<T> Matrix<T> where T: Any + Float

Returns H, where H is the upper hessenberg form.

If the transformation matrix is also required, you should use upper_hess_decomp.

Examples

use rulinalg::matrix::Matrix;

let a = Matrix::new(4,4,vec![2.,0.,1.,1.,2.,0.,1.,2.,1.,2.,0.,0.,2.,0.,1.,1.]);
let h = a.upper_hessenberg();

println!("{:?}", h.expect("Could not get upper Hessenberg form.").data());

Panics

  • The matrix is not square.

Failures

  • The matrix cannot be reduced to upper hessenberg form.

Returns (U,H), where H is the upper hessenberg form and U is the unitary transform matrix.

Note: The current transform matrix seems broken...

Examples

use rulinalg::matrix::{Matrix, BaseMatrix};

let a = Matrix::new(3,3,vec![1.,2.,3.,4.,5.,6.,7.,8.,9.]);

// u is the transform, h is the upper hessenberg form.
let (u,h) = a.clone().upper_hess_decomp().expect("This matrix should decompose!");

println!("The hess : {:?}", h.data());
println!("Manual hess : {:?}", (u.transpose() * a * u).data());

Panics

  • The matrix is not square.

Failures

  • The matrix cannot be reduced to upper hessenberg form.

impl<T> Matrix<T> where T: Any + Float

Computes L, U, and P for LUP decomposition.

Returns L,U, and P respectively.

Examples

use rulinalg::matrix::Matrix;

let a = Matrix::new(3,3, vec![1.0,2.0,0.0,
                              0.0,3.0,4.0,
                              5.0, 1.0, 2.0]);

let (l,u,p) = a.lup_decomp().expect("This matrix should decompose!");

Panics

  • Matrix is not square.

Failures

  • Matrix cannot be LUP decomposed.

impl<T> Matrix<T> where T: Any + Signed + Float

Eigenvalues of a square matrix.

Returns a Vec of eigenvalues.

Examples

use rulinalg::matrix::Matrix;

let a = Matrix::new(4,4, (1..17).map(|v| v as f64).collect::<Vec<f64>>());
let e = a.eigenvalues().expect("We should be able to compute these eigenvalues!");
println!("{:?}", e);

Panics

  • The matrix is not square.

Failures

  • Eigenvalues cannot be computed.

Eigendecomposition of a square matrix.

Returns a Vec of eigenvalues, and a matrix with eigenvectors as the columns.

The eigenvectors are only gauranteed to be correct if the matrix is real-symmetric.

Examples

use rulinalg::matrix::Matrix;

let a = Matrix::new(3,3,vec![3.,2.,4.,2.,0.,2.,4.,2.,3.]);

let (e, m) = a.eigendecomp().expect("We should be able to compute this eigendecomp!");
println!("{:?}", e);
println!("{:?}", m.data());

Panics

  • The matrix is not square.

Failures

  • The eigen decomposition can not be computed.

impl<T> Matrix<T>

Constructor for Matrix struct.

Requires both the row and column dimensions.

Examples

use rulinalg::matrix::{Matrix, BaseMatrix};

let mat = Matrix::new(2,2, vec![1.0,2.0,3.0,4.0]);

assert_eq!(mat.rows(), 2);
assert_eq!(mat.cols(), 2);

Panics

  • The input data does not match the given dimensions.

Constructor for Matrix struct that takes a function f and constructs a new matrix such that A_ij = f(i, j), where i is the row index and j the column index.

Requires both the row and column dimensions as well as a generating function.

Examples

use rulinalg::matrix::{Matrix, BaseMatrix};

// Let's assume you have an array of "things" for
// which you want to generate a distance matrix:
let things: [i32; 3] = [1, 2, 3];
let distances: Matrix<f64> = Matrix::from_fn(things.len(), things.len(), |col, row| {
    (things[col] - things[row]).abs().into()
});

assert_eq!(distances.rows(), 3);
assert_eq!(distances.cols(), 3);
assert_eq!(distances.data(), &vec![
    0.0, 1.0, 2.0,
    1.0, 0.0, 1.0,
    2.0, 1.0, 0.0,
]);

Returns a non-mutable reference to the underlying data.

Returns a mutable slice of the underlying data.

Consumes the Matrix and returns the Vec of data.

impl<T> Matrix<T> where T: Clone + Zero

Constructs matrix of all zeros.

Requires both the row and the column dimensions.

Examples

use rulinalg::matrix::Matrix;

let mat = Matrix::<f64>::zeros(2,3);

Constructs matrix with given diagonal.

Requires slice of diagonal elements.

Examples

use rulinalg::matrix::Matrix;

let mat = Matrix::from_diag(&vec![1.0,2.0,3.0,4.0]);

impl<T> Matrix<T> where T: Clone + One

Constructs matrix of all ones.

Requires both the row and the column dimensions.

Examples

use rulinalg::matrix::Matrix;

let mat = Matrix::<f64>::ones(2,3);

impl<T> Matrix<T> where T: Clone + Zero + One

Constructs the identity matrix.

Requires the size of the matrix.

Examples

use rulinalg::matrix::Matrix;

let I = Matrix::<f64>::identity(4);

impl<T> Matrix<T> where T: Float + FromPrimitive

The mean of the matrix along the specified axis.

  • Axis Row - Arithmetic mean of rows.
  • Axis Col - Arithmetic mean of columns.

Calling mean() on an empty matrix will return an empty matrix.

Examples

use rulinalg::matrix::{Matrix, Axes};

let a = Matrix::<f64>::new(2,2, vec![1.0,2.0,3.0,4.0]);

let c = a.mean(Axes::Row);
assert_eq!(*c.data(), vec![2.0, 3.0]);

let d = a.mean(Axes::Col);
assert_eq!(*d.data(), vec![1.5, 3.5]);

The variance of the matrix along the specified axis.

  • Axis Row - Sample variance of rows.
  • Axis Col - Sample variance of columns.

Examples

use rulinalg::matrix::{Matrix, Axes};

let a = Matrix::<f32>::new(2,2,vec![1.0,2.0,3.0,4.0]);

let c = a.variance(Axes::Row).unwrap();
assert_eq!(*c.data(), vec![2.0, 2.0]);

let d = a.variance(Axes::Col).unwrap();
assert_eq!(*d.data(), vec![0.5, 0.5]);

Failures

  • There are one or fewer row/columns in the working axis.

impl<T> Matrix<T> where T: Any + Float

Solves the equation Ax = y.

Requires a Vector y as input.

Examples

use rulinalg::matrix::Matrix;
use rulinalg::vector::Vector;

let a = Matrix::new(2,2, vec![2.0,3.0,1.0,2.0]);
let y = Vector::new(vec![13.0,8.0]);

let x = a.solve(y).unwrap();

assert_eq!(*x.data(), vec![2.0, 3.0]);

Panics

  • The matrix column count and vector size are different.
  • The matrix is not square.

Failures

  • The matrix cannot be decomposed into an LUP form to solve.
  • There is no valid solution as the matrix is singular.

Computes the inverse of the matrix.

Examples

use rulinalg::matrix::Matrix;

let a = Matrix::new(2,2, vec![2.,3.,1.,2.]);
let inv = a.inverse().expect("This matrix should have an inverse!");

let I = a * inv;

assert_eq!(*I.data(), vec![1.0,0.0,0.0,1.0]);

Panics

  • The matrix is not square.

Failures

  • The matrix could not be LUP decomposed.
  • The matrix has zero determinant.

Computes the determinant of the matrix.

Examples

use rulinalg::matrix::Matrix;

let a = Matrix::new(3,3, vec![1.0,2.0,0.0,
                              0.0,3.0,4.0,
                              5.0, 1.0, 2.0]);

let det = a.det();

Panics

  • The matrix is not square.

Trait Implementations

impl<T> Metric<T> for Matrix<T> where T: Float

Compute euclidean norm for matrix.

Examples

use rulinalg::matrix::Matrix;
use rulinalg::Metric;

let a = Matrix::new(2,1, vec![3.0,4.0]);
let c = a.norm();

assert_eq!(c, 5.0);

impl<T> Eq for Matrix<T> where T: Eq

impl<'a, T> FromIterator<&'a [T]> for Matrix<T> where T: Copy + 'a

Creates a Matrix from an iterator over slices.

Each of the slices produced by the iterator will become a row in the matrix.

Panics

Will panic if the iterators items do not have constant length.

Examples

We can create a new matrix from some data.

use rulinalg::matrix::{Matrix, BaseMatrix};

let a : Matrix<f64> = vec![4f64; 16].chunks(4).collect();

assert_eq!(a.rows(), 4);
assert_eq!(a.cols(), 4);

We can also do more interesting things.

use rulinalg::matrix::{Matrix, BaseMatrix};

let a = Matrix::new(4,2, (0..8).collect::<Vec<usize>>());

// Here we skip the first row and take only those
// where the first entry is less than 6.
let b = a.iter_rows()
         .skip(1)
         .filter(|x| x[0] < 6)
         .collect::<Matrix<usize>>();

// We take the middle rows
assert_eq!(b.into_vec(), vec![2,3,4,5]);

impl<T> BaseMatrix<T> for Matrix<T>

Rows in the matrix.

Columns in the matrix.

Row stride in the matrix.

Returns true if the matrix contais no elements

Top left index of the matrix.

Convert the matrix struct into a owned Matrix.

The sum of all elements in the matrix Read more

The elementwise product of two matrices. Read more

The elementwise division of two matrices. Read more

Vertically concatenates two matrices. With self on top. Read more

Returns a MatrixSlice over the whole matrix. Read more

Get a reference to a point in the matrix without bounds checking.

Returns the row of a matrix at the given index. None if the index is out of bounds. Read more

Returns the row of a matrix at the given index without doing unbounds checking Read more

Returns an iterator over the matrix data. Read more

Iterate over the rows of the matrix. Read more

Iterate over diagonal entries Read more

The sum of the rows of the matrix. Read more

The sum of the columns of the matrix. Read more

Select rows from matrix Read more

Select columns from matrix Read more

Select block matrix from matrix Read more

Horizontally concatenates two matrices. With self on the left. Read more

Extract the diagonal of the matrix Read more

Tranposes the given matrix Read more

Checks if matrix is diagonal. Read more

Solves an upper triangular linear system. Read more

Solves a lower triangular linear system. Read more

Split the matrix at the specified axis returning two MatrixSlices. Read more

Produce a MatrixSlice from an existing matrix. Read more

impl<T> AddAssign<T> for Matrix<T> where T: Copy + Add<T, Output=T>

Performs addition assignment between a matrix and a scalar.

impl<'a, T> AddAssign<&'a T> for Matrix<T> where T: Copy + Add<T, Output=T>

Performs addition assignment between a matrix and a scalar.

impl<T> AddAssign<Matrix<T>> for Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition assignment between two matrices.

impl<'a, T> AddAssign<&'a Matrix<T>> for Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition assignment between two matrices.

impl<'a, T> AddAssign<MatrixSlice<'a, T>> for Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition assignment between two matrices.

impl<'a, 'b, T> AddAssign<&'b MatrixSlice<'a, T>> for Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition assignment between two matrices.

impl<'a, T> AddAssign<MatrixSliceMut<'a, T>> for Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition assignment between two matrices.

impl<'a, 'b, T> AddAssign<&'b MatrixSliceMut<'a, T>> for Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition assignment between two matrices.

impl<T> DivAssign<T> for Matrix<T> where T: Copy + Div<T, Output=T>

Performs division assignment between a matrix and a scalar.

impl<'a, T> DivAssign<&'a T> for Matrix<T> where T: Copy + Div<T, Output=T>

Performs division assignment between a matrix and a scalar.

impl<T> MulAssign<T> for Matrix<T> where T: Copy + Mul<T, Output=T>

Performs multiplication assignment between a matrix and a scalar.

impl<'a, T> MulAssign<&'a T> for Matrix<T> where T: Copy + Mul<T, Output=T>

Performs multiplication assignment between a matrix and a scalar.

impl<T> Sub<T> for Matrix<T> where T: Copy + Sub<T, Output=T>

Scalar subtraction with matrix.

Will reuse the memory allocated for the existing matrix.

impl<'a, T> Sub<&'a T> for Matrix<T> where T: Copy + Sub<T, Output=T>

Scalar subtraction with matrix.

Will reuse the memory allocated for the existing matrix.

impl<'a, T> Sub<T> for &'a Matrix<T> where T: Copy + Sub<T, Output=T>

Scalar subtraction with matrix.

impl<'a, 'b, T> Sub<&'b T> for &'a Matrix<T> where T: Copy + Sub<T, Output=T>

Scalar subtraction with matrix.

impl<'a, T> Sub<MatrixSlice<'a, T>> for Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction between Matrix and MatrixSlice.

impl<'a, 'b, T> Sub<MatrixSlice<'a, T>> for &'b Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction between Matrix and MatrixSlice.

impl<'a, 'b, T> Sub<&'b MatrixSlice<'a, T>> for Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction between Matrix and MatrixSlice.

impl<'a, 'b, 'c, T> Sub<&'c MatrixSlice<'a, T>> for &'b Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction between Matrix and MatrixSlice.

impl<'a, T> Sub<MatrixSliceMut<'a, T>> for Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction between Matrix and MatrixSlice.

impl<'a, 'b, T> Sub<MatrixSliceMut<'a, T>> for &'b Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction between Matrix and MatrixSlice.

impl<'a, 'b, T> Sub<&'b MatrixSliceMut<'a, T>> for Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction between Matrix and MatrixSlice.

impl<'a, 'b, 'c, T> Sub<&'c MatrixSliceMut<'a, T>> for &'b Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction between Matrix and MatrixSlice.

impl<T> Sub<Matrix<T>> for Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction between two matrices.

This will reuse allocated memory from self.

impl<'a, T> Sub<Matrix<T>> for &'a Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction between two matrices.

This will reuse allocated memory from m.

impl<'a, T> Sub<&'a Matrix<T>> for Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction between two matrices.

This will reuse allocated memory from self.

impl<'a, 'b, T> Sub<&'b Matrix<T>> for &'a Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction between two matrices.

impl<T> Clone for Matrix<T> where T: Clone

Clones the Matrix.

Performs copy-assignment from source. Read more

impl<T> Hash for Matrix<T> where T: Hash

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

impl<T> Mul<Vector<T>> for Matrix<T> where T: Zero<Output=T> + Mul<T, Output=T> + Add<T> + Copy

Multiplies matrix by vector.

The resulting type after applying the * operator

The method for the * operator

impl<'a, T> Mul<Vector<T>> for &'a Matrix<T> where T: Zero<Output=T> + Mul<T, Output=T> + Add<T> + Copy

Multiplies matrix by vector.

The resulting type after applying the * operator

The method for the * operator

impl<'a, T> Mul<&'a Vector<T>> for Matrix<T> where T: Zero<Output=T> + Mul<T, Output=T> + Add<T> + Copy

Multiplies matrix by vector.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T> Mul<&'b Vector<T>> for &'a Matrix<T> where T: Zero<Output=T> + Mul<T, Output=T> + Add<T> + Copy

Multiplies matrix by vector.

The resulting type after applying the * operator

The method for the * operator

impl<'a, T> Mul<Matrix<T>> for Matrix<T> where T: Add<T, Output=T> + Mul<T, Output=T> + Any + Zero + Copy

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T> Mul<&'a Matrix<T>> for Matrix<T> where T: Copy + Zero<Output=T> + Add<T> + Mul<T, Output=T> + Any

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, T> Mul<Matrix<T>> for &'a Matrix<T> where T: Copy + Zero<Output=T> + Add<T> + Mul<T, Output=T> + Any

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T> Mul<&'b Matrix<T>> for &'a Matrix<T> where T: Copy + Zero<Output=T> + Add<T> + Mul<T, Output=T> + Any

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<T> Mul<T> for Matrix<T> where T: Copy + Mul<T, Output=T>

Scalar multiplication with matrix.

Will reuse the memory allocated for the existing matrix.

The resulting type after applying the * operator

The method for the * operator

impl<'a, T> Mul<&'a T> for Matrix<T> where T: Copy + Mul<T, Output=T>

Scalar multiplication with matrix.

Will reuse the memory allocated for the existing matrix.

The resulting type after applying the * operator

The method for the * operator

impl<'a, T> Mul<T> for &'a Matrix<T> where T: Copy + Mul<T, Output=T>

Scalar multiplication with matrix.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T> Mul<&'b T> for &'a Matrix<T> where T: Copy + Mul<T, Output=T>

Scalar multiplication with matrix.

The resulting type after applying the * operator

The method for the * operator

impl<'a, T> Mul<MatrixSlice<'a, T>> for Matrix<T> where T: Copy + Zero<Output=T> + Add<T> + Mul<T, Output=T> + Any

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T> Mul<&'b MatrixSlice<'a, T>> for Matrix<T> where T: Copy + Zero<Output=T> + Add<T> + Mul<T, Output=T> + Any

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T> Mul<MatrixSlice<'a, T>> for &'b Matrix<T> where T: Copy + Zero<Output=T> + Add<T> + Mul<T, Output=T> + Any

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, 'c, T> Mul<&'c MatrixSlice<'a, T>> for &'b Matrix<T> where T: Copy + Zero<Output=T> + Add<T> + Mul<T, Output=T> + Any

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, T> Mul<MatrixSliceMut<'a, T>> for Matrix<T> where T: Copy + Zero<Output=T> + Add<T> + Mul<T, Output=T> + Any

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T> Mul<&'b MatrixSliceMut<'a, T>> for Matrix<T> where T: Copy + Zero<Output=T> + Add<T> + Mul<T, Output=T> + Any

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T> Mul<MatrixSliceMut<'a, T>> for &'b Matrix<T> where T: Copy + Zero<Output=T> + Add<T> + Mul<T, Output=T> + Any

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, 'c, T> Mul<&'c MatrixSliceMut<'a, T>> for &'b Matrix<T> where T: Copy + Zero<Output=T> + Add<T> + Mul<T, Output=T> + Any

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<T> BaseMatrixMut<T> for Matrix<T>

Top left index of the slice.

Returns a MatrixSliceMut over the whole matrix. Read more

Get a mutable reference to a point in the matrix without bounds checks.

Returns a mutable iterator over the matrix. Read more

Returns a mutable reference to the row of a matrix at the given index. None if the index is out of bounds. Read more

Returns a mutable reference to the row of a matrix at the given index without doing unbounds checking Read more

Swaps two rows in a matrix. Read more

Swaps two columns in a matrix. Read more

Iterate over the mutable rows of the matrix. Read more

Iterate over diagonal entries mutably Read more

Sets the underlying matrix data to the target data. Read more

Applies a function to each element in the matrix. Read more

Split the matrix at the specified axis returning two MatrixSliceMuts. Read more

Produce a MatrixSliceMut from an existing matrix. Read more

impl<T> Index<[usize; 2]> for Matrix<T>

Indexes matrix.

Takes row index first then column.

impl<T> Add<T> for Matrix<T> where T: Copy + Add<T, Output=T>

Scalar addition with matrix.

Will reuse the memory allocated for the existing matrix.

The resulting type after applying the + operator

The method for the + operator

impl<'a, T> Add<&'a T> for Matrix<T> where T: Copy + Add<T, Output=T>

Scalar addition with matrix.

Will reuse the memory allocated for the existing matrix.

The resulting type after applying the + operator

The method for the + operator

impl<'a, T> Add<T> for &'a Matrix<T> where T: Copy + Add<T, Output=T>

Scalar addition with matrix.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, T> Add<&'b T> for &'a Matrix<T> where T: Copy + Add<T, Output=T>

Scalar addition with matrix.

The resulting type after applying the + operator

The method for the + operator

impl<'a, T> Add<MatrixSlice<'a, T>> for Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, T> Add<MatrixSlice<'a, T>> for &'b Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, T> Add<&'b MatrixSlice<'a, T>> for Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, 'c, T> Add<&'c MatrixSlice<'a, T>> for &'b Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, T> Add<MatrixSliceMut<'a, T>> for Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, T> Add<MatrixSliceMut<'a, T>> for &'b Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, T> Add<&'b MatrixSliceMut<'a, T>> for Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, 'c, T> Add<&'c MatrixSliceMut<'a, T>> for &'b Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator

The method for the + operator

impl<T> Add<Matrix<T>> for Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition between two matrices.

This will reuse allocated memory from self.

The resulting type after applying the + operator

The method for the + operator

impl<'a, T> Add<Matrix<T>> for &'a Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition between two matrices.

This will reuse allocated memory from m.

The resulting type after applying the + operator

The method for the + operator

impl<'a, T> Add<&'a Matrix<T>> for Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition between two matrices.

This will reuse allocated memory from self.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, T> Add<&'b Matrix<T>> for &'a Matrix<T> where T: Copy + Add<T, Output=T>

Performs elementwise addition between two matrices.

The resulting type after applying the + operator

The method for the + operator

impl<T> PartialEq<Matrix<T>> for Matrix<T> where T: PartialEq<T>

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T> IndexMut<[usize; 2]> for Matrix<T>

Indexes mutable matrix.

Takes row index first then column.

impl<T> Debug for Matrix<T> where T: Debug

Formats the value using the given formatter.

impl<T> SubAssign<T> for Matrix<T> where T: Copy + Sub<T, Output=T>

Performs subtraction assignment between a matrix and a scalar.

impl<'a, T> SubAssign<&'a T> for Matrix<T> where T: Copy + Sub<T, Output=T>

Performs subtraction assignment between a matrix and a scalar.

impl<T> SubAssign<Matrix<T>> for Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction assignment between two matrices.

impl<'a, T> SubAssign<&'a Matrix<T>> for Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction assignment between two matrices.

impl<'a, T> SubAssign<MatrixSlice<'a, T>> for Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction assignment between two matrices.

impl<'a, 'b, T> SubAssign<&'b MatrixSlice<'a, T>> for Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction assignment between two matrices.

impl<'a, T> SubAssign<MatrixSliceMut<'a, T>> for Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction assignment between two matrices.

impl<'a, 'b, T> SubAssign<&'b MatrixSliceMut<'a, T>> for Matrix<T> where T: Copy + Sub<T, Output=T>

Performs elementwise subtraction assignment between two matrices.

impl<T> Display for Matrix<T> where T: Display

Formats the Matrix for display.

impl<T> From<Vector<T>> for Matrix<T>

Performs the conversion.

impl<'a, T> From<MatrixSlice<'a, T>> for Matrix<T> where T: Copy

Performs the conversion.

impl<'a, T> From<MatrixSliceMut<'a, T>> for Matrix<T> where T: Copy

Performs the conversion.

impl<T> Div<T> for Matrix<T> where T: Copy + Div<T, Output=T>

Scalar division with matrix.

Will reuse the memory allocated for the existing matrix.

impl<'a, T> Div<&'a T> for Matrix<T> where T: Copy + Div<T, Output=T>

Scalar division with matrix.

Will reuse the memory allocated for the existing matrix.

impl<'a, T> Div<T> for &'a Matrix<T> where T: Copy + Div<T, Output=T>

Scalar division with matrix.

impl<'a, 'b, T> Div<&'b T> for &'a Matrix<T> where T: Copy + Div<T, Output=T>

Scalar division with matrix.

impl<T> Neg for Matrix<T> where T: Neg<Output=T> + Copy

Gets negative of matrix.

impl<'a, T> Neg for &'a Matrix<T> where T: Neg<Output=T> + Copy

Gets negative of matrix.