Struct rulinalg::matrix::Matrix
[−]
[src]
pub struct Matrix<T> { // some fields omitted }
The Matrix
struct.
Can be instantiated with any type.
Methods
impl<T: Any + Float> Matrix<T>
[src]
fn cholesky(&self) -> Result<Matrix<T>, Error>
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.
fn qr_decomp(self) -> Result<(Matrix<T>, Matrix<T>), Error>
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.
fn bidiagonal_decomp(self) -> Result<(Matrix<T>, Matrix<T>, Matrix<T>), Error>
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: Any + Float + Signed> Matrix<T>
[src]
fn svd(self) -> Result<(Matrix<T>, Matrix<T>, Matrix<T>), Error>
Singular Value Decomposition
Computes the SVD using Golub-Reinsch algorithm.
Returns Σ, U, V where self = U Σ VT.
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.
fn upper_hessenberg(self) -> Result<Matrix<T>, Error>
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.
fn upper_hess_decomp(self) -> Result<(Matrix<T>, Matrix<T>), Error>
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; 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.
fn eigenvalues(&self) -> Result<Vec<T>, Error>
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.
fn eigendecomp(&self) -> Result<(Vec<T>, Matrix<T>), Error>
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> where T: Any + Copy + One + Zero + Neg<Output=T> + Add<T, Output=T> + Mul<T, Output=T> + Sub<T, Output=T> + Div<T, Output=T> + PartialOrd
[src]
fn lup_decomp(&self) -> Result<(Matrix<T>, Matrix<T>, Matrix<T>), Error>
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>
[src]
fn iter_rows(&self) -> Rows<T>
Iterate over the rows of the matrix.
Examples
use rulinalg::matrix::Matrix; let a = Matrix::new(3, 2, (0..6).collect::<Vec<usize>>()); // Prints "2" three times. for row in a.iter_rows() { println!("{}", row.len()); }
fn iter_rows_mut(&mut self) -> RowsMut<T>
Iterate over the mutable rows of the matrix.
Examples
use rulinalg::matrix::Matrix; let mut a = Matrix::new(3, 2, (0..6).collect::<Vec<usize>>()); for row in a.iter_rows_mut() { for r in row { *r = *r + 1; } } // Now contains the range 1..7 println!("{}", a);
impl<T> Matrix<T>
[src]
fn new<U: Into<Vec<T>>>(rows: usize, cols: usize, data: U) -> Matrix<T>
Constructor for Matrix struct.
Requires both the row and column dimensions.
Examples
use rulinalg::matrix::Matrix; 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.
fn rows(&self) -> usize
Returns the number of rows in the Matrix.
fn cols(&self) -> usize
Returns the number of columns in the Matrix.
fn row_stride(&self) -> usize
Returns the row-stride of the matrix. This is simply its column count.
fn data(&self) -> &Vec<T>
Returns a non-mutable reference to the underlying data.
fn mut_data(&mut self) -> &mut [T]
Returns a mutable slice of the underlying data.
unsafe fn get_unchecked(&self, index: [usize; 2]) -> &T
Get a reference to a point in the matrix without bounds checks.
unsafe fn get_unchecked_mut(&mut self, index: [usize; 2]) -> &mut T
Get a mutable reference to a point in the matrix without bounds checks.
fn as_ptr(&self) -> *const T
Returns pointer to first element of underlying data.
fn into_vec(self) -> Vec<T>
Consumes the Matrix and returns the Vec of data.
fn split_at(&self, mid: usize, axis: Axes) -> (MatrixSlice<T>, MatrixSlice<T>)
Split the matrix at the specified axis returning two MatrixSlice
s.
Examples
use rulinalg::matrix::Matrix; use rulinalg::matrix::Axes; let a = Matrix::new(3,3, vec![2.0; 9]); let (b,c) = a.split_at(1, Axes::Row);
fn split_at_mut(&mut self, mid: usize, axis: Axes) -> (MatrixSliceMut<T>, MatrixSliceMut<T>)
Split the matrix at the specified axis returning two MatrixSlice
s.
Examples
use rulinalg::matrix::Matrix; use rulinalg::matrix::Axes; let mut a = Matrix::new(3,3, vec![2.0; 9]); let (b,c) = a.split_at_mut(1, Axes::Col);
fn as_slice(&self) -> MatrixSlice<T>
Returns a MatrixSlice
over the whole matrix.
Examples
use rulinalg::matrix::Matrix; let a = Matrix::new(3, 3, vec![2.0; 9]); let b = a.as_slice();
fn as_mut_slice(&mut self) -> MatrixSliceMut<T>
Returns a mutable MatrixSlice
over the whole matrix.
Examples
use rulinalg::matrix::Matrix; let mut a = Matrix::new(3, 3, vec![2.0; 9]); let b = a.as_mut_slice();
fn get_row(&self, index: usize) -> Option<&[T]>
Returns the row of a Matrix
at the given index.
None
if the index is out of bounds.
Examples
use rulinalg::matrix::Matrix; let a = Matrix::new(3, 4, vec![2.0; 12]); let row = a.get_row(1); let expected = vec![2.0; 4]; assert_eq!(row, Some(&*expected)); assert!(a.get_row(5).is_none());
unsafe fn get_row_unchecked(&self, index: usize) -> &[T]
Returns the row of a Matrix
at the given index without doing unbounds checking
Examples
use rulinalg::matrix::Matrix; let a = Matrix::new(3, 4, vec![2.0; 12]); let row = unsafe { a.get_row_unchecked(1) }; let expected = vec![2.0; 4]; assert_eq!(row, &*expected);
fn get_row_mut(&mut self, index: usize) -> Option<&mut [T]>
Returns a mutable reference to the row of a Matrix
at the given index.
None
if the index is out of bounds.
Examples
use rulinalg::matrix::Matrix; let mut a = Matrix::new(3, 4, vec![2.0; 12]); { let row = a.get_row_mut(1); let mut expected = vec![2.0; 4]; assert_eq!(row, Some(&mut *expected)); } assert!(a.get_row_mut(5).is_none());
unsafe fn get_row_unchecked_mut(&mut self, index: usize) -> &mut [T]
Returns a mutable reference to the row of a Matrix
at the given index
without doing unbounds checking
Examples
use rulinalg::matrix::Matrix; let mut a = Matrix::new(3, 4, vec![2.0; 12]); let row = unsafe { a.get_row_unchecked_mut(1) }; let mut expected = vec![2.0; 4]; assert_eq!(row, &mut *expected);
impl<T: Copy> Matrix<T>
[src]
fn select_rows(&self, rows: &[usize]) -> Matrix<T>
Select rows from matrix
Examples
use rulinalg::matrix::Matrix; let a = Matrix::<f64>::ones(3,3); let b = &a.select_rows(&[2]); assert_eq!(b.rows(), 1); assert_eq!(b.cols(), 3); let c = &a.select_rows(&[1,2]); assert_eq!(c.rows(), 2); assert_eq!(c.cols(), 3);
Panics
- Panics if row indices exceed the matrix dimensions.
fn select_cols(&self, cols: &[usize]) -> Matrix<T>
Select columns from matrix
Examples
use rulinalg::matrix::Matrix; let a = Matrix::<f64>::ones(3,3); let b = &a.select_cols(&[2]); assert_eq!(b.rows(), 3); assert_eq!(b.cols(), 1); let c = &a.select_cols(&[1,2]); assert_eq!(c.rows(), 3); assert_eq!(c.cols(), 2);
Panics
- Panics if column indices exceed the matrix dimensions.
fn select(&self, rows: &[usize], cols: &[usize]) -> Matrix<T>
Select block matrix from matrix
Examples
use rulinalg::matrix::Matrix; let a = Matrix::<f64>::identity(3); let b = &a.select(&[0,1], &[1,2]); // We get the 2x2 block matrix in the upper right corner. assert_eq!(b.rows(), 2); assert_eq!(b.cols(), 2); // Prints [0,0,1,0] println!("{:?}", b.data());
Panics
- Panics if row or column indices exceed the matrix dimensions.
fn hcat(&self, m: &Matrix<T>) -> Matrix<T>
Horizontally concatenates two matrices. With self on the left.
Examples
use rulinalg::matrix::Matrix; let a = Matrix::new(3,2, vec![1.0,2.0,3.0,4.0,5.0,6.0]); let b = Matrix::new(3,1, vec![4.0,5.0,6.0]); let c = &a.hcat(&b); assert_eq!(c.cols(), a.cols() + b.cols()); assert_eq!(c[[1, 2]], 5.0);
Panics
- Self and m have different row counts.
fn vcat(&self, m: &Matrix<T>) -> Matrix<T>
Vertically concatenates two matrices. With self on top.
Examples
use rulinalg::matrix::Matrix; let a = Matrix::new(2,3, vec![1.0,2.0,3.0,4.0,5.0,6.0]); let b = Matrix::new(1,3, vec![4.0,5.0,6.0]); let c = &a.vcat(&b); assert_eq!(c.rows(), a.rows() + b.rows()); assert_eq!(c[[2, 2]], 6.0);
Panics
- Self and m have different column counts.
fn diag(&self) -> Vector<T>
Extract the diagonal of the matrix
Examples
use rulinalg::matrix::Matrix; use rulinalg::vector::Vector; let a = Matrix::new(3,3,vec![1,2,3,4,5,6,7,8,9]); let b = Matrix::new(3,2,vec![1,2,3,4,5,6]); let c = Matrix::new(2,3,vec![1,2,3,4,5,6]); let d = &a.diag(); // 1,5,9 let e = &b.diag(); // 1,4 let f = &c.diag(); // 1,5 assert_eq!(*d.data(), vec![1,5,9]); assert_eq!(*e.data(), vec![1,4]); assert_eq!(*f.data(), vec![1,5]);
fn apply(self, f: &Fn(T) -> T) -> Matrix<T>
Applies a function to each element in the matrix.
Examples
use rulinalg::matrix::Matrix; fn add_two(a: f64) -> f64 { a + 2f64 } let a = Matrix::new(2, 2, vec![0.;4]); let b = a.apply(&add_two); assert_eq!(*b.data(), vec![2.0; 4]);
fn transpose(&self) -> Matrix<T>
Tranposes the given matrix
Examples
use rulinalg::matrix::Matrix; let mat = Matrix::new(2,3, vec![1.0,2.0,3.0,4.0,5.0,6.0]); let mt = mat.transpose();
impl<T: Clone + Zero> Matrix<T>
[src]
fn zeros(rows: usize, cols: usize) -> Matrix<T>
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);
fn from_diag(diag: &[T]) -> Matrix<T>
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: Clone + One> Matrix<T>
[src]
fn ones(rows: usize, cols: usize) -> Matrix<T>
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: Clone + Zero + One> Matrix<T>
[src]
fn identity(size: usize) -> Matrix<T>
Constructs the identity matrix.
Requires the size of the matrix.
Examples
use rulinalg::matrix::Matrix; let I = Matrix::<f64>::identity(4);
impl<T: Copy + Zero + One + PartialEq> Matrix<T>
[src]
fn is_diag(&self) -> bool
Checks if matrix is diagonal.
Examples
use rulinalg::matrix::Matrix; let a = Matrix::new(2,2, vec![1.0,0.0,0.0,1.0]); let a_diag = a.is_diag(); assert_eq!(a_diag, true); let b = Matrix::new(2,2, vec![1.0,0.0,1.0,0.0]); let b_diag = b.is_diag(); assert_eq!(b_diag, false);
impl<T: Copy + Zero + Add<T, Output=T>> Matrix<T>
[src]
fn sum_rows(&self) -> Vector<T>
The sum of the rows of the matrix.
Returns a Vector equal to the sum of the matrices rows.
Examples
use rulinalg::matrix::Matrix; let a = Matrix::new(2,2,vec![1.0,2.0,3.0,4.0]); let c = a.sum_rows(); assert_eq!(*c.data(), vec![4.0, 6.0]);
fn sum_cols(&self) -> Vector<T>
The sum of the columns of the matrix.
Returns a Vector equal to the sum of the matrices columns.
Examples
use rulinalg::matrix::Matrix; let a = Matrix::new(2,2,vec![1.0,2.0,3.0,4.0]); let c = a.sum_cols(); assert_eq!(*c.data(), vec![3.0, 7.0]);
fn sum(&self) -> T
The sum of all elements in the matrix
Examples
use rulinalg::matrix::Matrix; let a = Matrix::new(2,2,vec![1.0,2.0,3.0,4.0]); let c = a.sum(); assert_eq!(c, 10.0);
impl<T: Copy + Mul<T, Output=T>> Matrix<T>
[src]
fn elemul(&self, m: &Matrix<T>) -> Matrix<T>
The elementwise product of two matrices.
Examples
use rulinalg::matrix::Matrix; let a = Matrix::new(2,2,vec![1.0,2.0,3.0,4.0]); let b = Matrix::new(2,2,vec![1.0,2.0,3.0,4.0]); let c = &a.elemul(&b); assert_eq!(*c.data(), vec![1.0, 4.0, 9.0, 16.0]);
Panics
- The matrices have different row counts.
- The matrices have different column counts.
impl<T: Copy + Div<T, Output=T>> Matrix<T>
[src]
fn elediv(&self, m: &Matrix<T>) -> Matrix<T>
The elementwise division of two matrices.
Examples
use rulinalg::matrix::Matrix; let a = Matrix::new(2,2,vec![1.0,2.0,3.0,4.0]); let b = Matrix::new(2,2,vec![1.0,2.0,3.0,4.0]); let c = &a.elediv(&b); assert_eq!(*c.data(), vec![1.0; 4]);
Panics
- The matrices have different row counts.
- The matrices have different column counts.
impl<T: Float + FromPrimitive> Matrix<T>
[src]
fn mean(&self, axis: Axes) -> Vector<T>
The mean of the matrix along the specified axis.
Axis Row - Arithmetic mean of rows. Axis Col - Arithmetic mean of columns.
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]);
fn variance(&self, axis: Axes) -> Vector<T>
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); assert_eq!(*c.data(), vec![2.0, 2.0]); let d = a.variance(Axes::Col); assert_eq!(*d.data(), vec![0.5, 0.5]);
impl<T: Any + Float> Matrix<T>
[src]
fn solve_u_triangular(&self, y: Vector<T>) -> Result<Vector<T>, Error>
Solves an upper triangular linear system.
Given a matrix U
, which is upper triangular, and a vector y
, this function returns x
such that Ux = y
.
Examples
use rulinalg::matrix::Matrix; use rulinalg::vector::Vector; use std::f32; let u = Matrix::new(2,2, vec![1.0, 2.0, 0.0, 1.0]); let y = Vector::new(vec![3.0, 1.0]); let x = u.solve_u_triangular(y).expect("A solution should exist!"); assert!((x[0] - 1.0) < f32::EPSILON); assert!((x[1] - 1.0) < f32::EPSILON);
Panics
- Vector size and matrix column count are not equal.
- Matrix is not upper triangular.
Failures
Fails if there is no valid solution to the system (matrix is singular).
fn solve_l_triangular(&self, y: Vector<T>) -> Result<Vector<T>, Error>
Solves a lower triangular linear system.
Given a matrix L
, which is lower triangular, and a vector y
, this function returns x
such that Lx = y
.
Examples
use rulinalg::matrix::Matrix; use rulinalg::vector::Vector; use std::f32; let l = Matrix::new(2,2, vec![1.0, 0.0, 2.0, 1.0]); let y = Vector::new(vec![1.0, 3.0]); let x = l.solve_l_triangular(y).expect("A solution should exist!"); println!("{:?}", x); assert!((x[0] - 1.0) < f32::EPSILON); assert!((x[1] - 1.0) < f32::EPSILON);
Panics
- Vector size and matrix column count are not equal.
- Matrix is not lower triangular.
Failures
Fails if there is no valid solution to the system (matrix is singular).
fn solve(&self, y: Vector<T>) -> Result<Vector<T>, Error>
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.
fn inverse(&self) -> Result<Matrix<T>, Error>
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.
fn det(&self) -> T
Trait Implementations
impl<T> Index<[usize; 2]> for Matrix<T>
[src]
Indexes matrix.
Takes row index first then column.
type Output = T
The returned type after indexing
fn index(&self, idx: [usize; 2]) -> &T
The method for the indexing (Foo[Bar]
) operation
impl<T> IndexMut<[usize; 2]> for Matrix<T>
[src]
Indexes mutable matrix.
Takes row index first then column.
impl<T: Copy + Add<T, Output=T>> Add<T> for Matrix<T>
[src]
Scalar addition with matrix.
Will reuse the memory allocated for the existing matrix.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, f: T) -> Matrix<T>
The method for the +
operator
impl<'a, T: Copy + Add<T, Output=T>> Add<&'a T> for Matrix<T>
[src]
Scalar addition with matrix.
Will reuse the memory allocated for the existing matrix.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, f: &T) -> Matrix<T>
The method for the +
operator
impl<'a, T: Copy + Add<T, Output=T>> Add<T> for &'a Matrix<T>
[src]
Scalar addition with matrix.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, f: T) -> Matrix<T>
The method for the +
operator
impl<'a, 'b, T: Copy + Add<T, Output=T>> Add<&'b T> for &'a Matrix<T>
[src]
Scalar addition with matrix.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, f: &T) -> Matrix<T>
The method for the +
operator
impl<T: Copy + Mul<T, Output=T>> Mul<T> for Matrix<T>
[src]
Scalar multiplication with matrix.
Will reuse the memory allocated for the existing matrix.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, f: T) -> Matrix<T>
The method for the *
operator
impl<'a, T: Copy + Mul<T, Output=T>> Mul<&'a T> for Matrix<T>
[src]
Scalar multiplication with matrix.
Will reuse the memory allocated for the existing matrix.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, f: &T) -> Matrix<T>
The method for the *
operator
impl<'a, T: Copy + Mul<T, Output=T>> Mul<T> for &'a Matrix<T>
[src]
Scalar multiplication with matrix.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, f: T) -> Matrix<T>
The method for the *
operator
impl<'a, 'b, T: Copy + Mul<T, Output=T>> Mul<&'b T> for &'a Matrix<T>
[src]
Scalar multiplication with matrix.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, f: &T) -> Matrix<T>
The method for the *
operator
impl<T: Copy + Sub<T, Output=T>> Sub<T> for Matrix<T>
[src]
Scalar subtraction with matrix.
Will reuse the memory allocated for the existing matrix.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, f: T) -> Matrix<T>
The method for the -
operator
impl<'a, T: Copy + Sub<T, Output=T>> Sub<&'a T> for Matrix<T>
[src]
Scalar subtraction with matrix.
Will reuse the memory allocated for the existing matrix.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, f: &T) -> Matrix<T>
The method for the -
operator
impl<'a, T: Copy + Sub<T, Output=T>> Sub<T> for &'a Matrix<T>
[src]
Scalar subtraction with matrix.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, f: T) -> Matrix<T>
The method for the -
operator
impl<'a, 'b, T: Copy + Sub<T, Output=T>> Sub<&'b T> for &'a Matrix<T>
[src]
Scalar subtraction with matrix.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, f: &T) -> Matrix<T>
The method for the -
operator
impl<T: Copy + Div<T, Output=T>> Div<T> for Matrix<T>
[src]
Scalar division with matrix.
Will reuse the memory allocated for the existing matrix.
type Output = Matrix<T>
The resulting type after applying the /
operator
fn div(self, f: T) -> Matrix<T>
The method for the /
operator
impl<'a, T: Copy + Div<T, Output=T>> Div<&'a T> for Matrix<T>
[src]
Scalar division with matrix.
Will reuse the memory allocated for the existing matrix.
type Output = Matrix<T>
The resulting type after applying the /
operator
fn div(self, f: &T) -> Matrix<T>
The method for the /
operator
impl<'a, T: Copy + Div<T, Output=T>> Div<T> for &'a Matrix<T>
[src]
Scalar division with matrix.
type Output = Matrix<T>
The resulting type after applying the /
operator
fn div(self, f: T) -> Matrix<T>
The method for the /
operator
impl<'a, 'b, T: Copy + Div<T, Output=T>> Div<&'b T> for &'a Matrix<T>
[src]
Scalar division with matrix.
type Output = Matrix<T>
The resulting type after applying the /
operator
fn div(self, f: &T) -> Matrix<T>
The method for the /
operator
impl<T> Mul<Vector<T>> for Matrix<T> where T: Copy + Zero + Mul<T, Output=T> + Add<T, Output=T>
[src]
Multiplies matrix by vector.
type Output = Vector<T>
The resulting type after applying the *
operator
fn mul(self, m: Vector<T>) -> Vector<T>
The method for the *
operator
impl<'a, T> Mul<Vector<T>> for &'a Matrix<T> where T: Copy + Zero + Mul<T, Output=T> + Add<T, Output=T>
[src]
Multiplies matrix by vector.
type Output = Vector<T>
The resulting type after applying the *
operator
fn mul(self, m: Vector<T>) -> Vector<T>
The method for the *
operator
impl<'a, T> Mul<&'a Vector<T>> for Matrix<T> where T: Copy + Zero + Mul<T, Output=T> + Add<T, Output=T>
[src]
Multiplies matrix by vector.
type Output = Vector<T>
The resulting type after applying the *
operator
fn mul(self, m: &Vector<T>) -> Vector<T>
The method for the *
operator
impl<'a, 'b, T> Mul<&'b Vector<T>> for &'a Matrix<T> where T: Copy + Zero + Mul<T, Output=T> + Add<T, Output=T>
[src]
Multiplies matrix by vector.
type Output = Vector<T>
The resulting type after applying the *
operator
fn mul(self, v: &Vector<T>) -> Vector<T>
The method for the *
operator
impl<'a, T: Copy + Add<T, Output=T>> Add<MatrixSlice<'a, T>> for Matrix<T>
[src]
Performs elementwise
addition
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, s: MatrixSlice<T>) -> Matrix<T>
The method for the +
operator
impl<'a, 'b, T: Copy + Add<T, Output=T>> Add<MatrixSlice<'a, T>> for &'b Matrix<T>
[src]
Performs elementwise
addition
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, s: MatrixSlice<T>) -> Matrix<T>
The method for the +
operator
impl<'a, 'b, T: Copy + Add<T, Output=T>> Add<&'b MatrixSlice<'a, T>> for Matrix<T>
[src]
Performs elementwise
addition
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, s: &MatrixSlice<T>) -> Matrix<T>
The method for the +
operator
impl<'a, 'b, 'c, T: Copy + Add<T, Output=T>> Add<&'c MatrixSlice<'a, T>> for &'b Matrix<T>
[src]
Performs elementwise
addition
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, s: &MatrixSlice<T>) -> Matrix<T>
The method for the +
operator
impl<'a, T: Copy + Add<T, Output=T>> Add<MatrixSliceMut<'a, T>> for Matrix<T>
[src]
Performs elementwise
addition
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, s: MatrixSliceMut<T>) -> Matrix<T>
The method for the +
operator
impl<'a, 'b, T: Copy + Add<T, Output=T>> Add<MatrixSliceMut<'a, T>> for &'b Matrix<T>
[src]
Performs elementwise
addition
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, s: MatrixSliceMut<T>) -> Matrix<T>
The method for the +
operator
impl<'a, 'b, T: Copy + Add<T, Output=T>> Add<&'b MatrixSliceMut<'a, T>> for Matrix<T>
[src]
Performs elementwise
addition
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, s: &MatrixSliceMut<T>) -> Matrix<T>
The method for the +
operator
impl<'a, 'b, 'c, T: Copy + Add<T, Output=T>> Add<&'c MatrixSliceMut<'a, T>> for &'b Matrix<T>
[src]
Performs elementwise
addition
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, s: &MatrixSliceMut<T>) -> Matrix<T>
The method for the +
operator
impl<'a, T: Copy + Sub<T, Output=T>> Sub<MatrixSlice<'a, T>> for Matrix<T>
[src]
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, s: MatrixSlice<T>) -> Matrix<T>
The method for the -
operator
impl<'a, 'b, T: Copy + Sub<T, Output=T>> Sub<MatrixSlice<'a, T>> for &'b Matrix<T>
[src]
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, s: MatrixSlice<T>) -> Matrix<T>
The method for the -
operator
impl<'a, 'b, T: Copy + Sub<T, Output=T>> Sub<&'b MatrixSlice<'a, T>> for Matrix<T>
[src]
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, s: &MatrixSlice<T>) -> Matrix<T>
The method for the -
operator
impl<'a, 'b, 'c, T: Copy + Sub<T, Output=T>> Sub<&'c MatrixSlice<'a, T>> for &'b Matrix<T>
[src]
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, s: &MatrixSlice<T>) -> Matrix<T>
The method for the -
operator
impl<'a, T: Copy + Sub<T, Output=T>> Sub<MatrixSliceMut<'a, T>> for Matrix<T>
[src]
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, s: MatrixSliceMut<T>) -> Matrix<T>
The method for the -
operator
impl<'a, 'b, T: Copy + Sub<T, Output=T>> Sub<MatrixSliceMut<'a, T>> for &'b Matrix<T>
[src]
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, s: MatrixSliceMut<T>) -> Matrix<T>
The method for the -
operator
impl<'a, 'b, T: Copy + Sub<T, Output=T>> Sub<&'b MatrixSliceMut<'a, T>> for Matrix<T>
[src]
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, s: &MatrixSliceMut<T>) -> Matrix<T>
The method for the -
operator
impl<'a, 'b, 'c, T: Copy + Sub<T, Output=T>> Sub<&'c MatrixSliceMut<'a, T>> for &'b Matrix<T>
[src]
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, s: &MatrixSliceMut<T>) -> Matrix<T>
The method for the -
operator
impl<T: Copy + Add<T, Output=T>> Add<Matrix<T>> for Matrix<T>
[src]
Performs elementwise addition between two matrices.
This will reuse allocated memory from self
.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, m: Matrix<T>) -> Matrix<T>
The method for the +
operator
impl<'a, T: Copy + Add<T, Output=T>> Add<Matrix<T>> for &'a Matrix<T>
[src]
Performs elementwise addition between two matrices.
This will reuse allocated memory from m
.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, m: Matrix<T>) -> Matrix<T>
The method for the +
operator
impl<'a, T: Copy + Add<T, Output=T>> Add<&'a Matrix<T>> for Matrix<T>
[src]
Performs elementwise addition between two matrices.
This will reuse allocated memory from self
.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, m: &Matrix<T>) -> Matrix<T>
The method for the +
operator
impl<'a, 'b, T: Copy + Add<T, Output=T>> Add<&'b Matrix<T>> for &'a Matrix<T>
[src]
Performs elementwise addition between two matrices.
type Output = Matrix<T>
The resulting type after applying the +
operator
fn add(self, m: &Matrix<T>) -> Matrix<T>
The method for the +
operator
impl<T: Copy + Sub<T, Output=T>> Sub<Matrix<T>> for Matrix<T>
[src]
Performs elementwise subtraction between two matrices.
This will reuse allocated memory from self
.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, m: Matrix<T>) -> Matrix<T>
The method for the -
operator
impl<'a, T: Copy + Sub<T, Output=T>> Sub<Matrix<T>> for &'a Matrix<T>
[src]
Performs elementwise subtraction between two matrices.
This will reuse allocated memory from m
.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, m: Matrix<T>) -> Matrix<T>
The method for the -
operator
impl<'a, T: Copy + Sub<T, Output=T>> Sub<&'a Matrix<T>> for Matrix<T>
[src]
Performs elementwise subtraction between two matrices.
This will reuse allocated memory from self
.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, m: &Matrix<T>) -> Matrix<T>
The method for the -
operator
impl<'a, 'b, T: Copy + Sub<T, Output=T>> Sub<&'b Matrix<T>> for &'a Matrix<T>
[src]
Performs elementwise subtraction between two matrices.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn sub(self, m: &Matrix<T>) -> Matrix<T>
The method for the -
operator
impl<T: Copy + Add<T, Output=T>> AddAssign<T> for Matrix<T>
[src]
Performs addition assignment between a matrix and a scalar.
fn add_assign(&mut self, _rhs: T)
The method for the +=
operator
impl<'a, T: Copy + Add<T, Output=T>> AddAssign<&'a T> for Matrix<T>
[src]
Performs addition assignment between a matrix and a scalar.
fn add_assign(&mut self, _rhs: &T)
The method for the +=
operator
impl<T: Copy + Sub<T, Output=T>> SubAssign<T> for Matrix<T>
[src]
Performs subtraction assignment between a matrix and a scalar.
fn sub_assign(&mut self, _rhs: T)
The method for the -=
operator
impl<'a, T: Copy + Sub<T, Output=T>> SubAssign<&'a T> for Matrix<T>
[src]
Performs subtraction assignment between a matrix and a scalar.
fn sub_assign(&mut self, _rhs: &T)
The method for the -=
operator
impl<T: Copy + Div<T, Output=T>> DivAssign<T> for Matrix<T>
[src]
Performs division assignment between a matrix and a scalar.
fn div_assign(&mut self, _rhs: T)
The method for the /=
operator
impl<'a, T: Copy + Div<T, Output=T>> DivAssign<&'a T> for Matrix<T>
[src]
Performs division assignment between a matrix and a scalar.
fn div_assign(&mut self, _rhs: &T)
The method for the /=
operator
impl<T: Copy + Mul<T, Output=T>> MulAssign<T> for Matrix<T>
[src]
Performs multiplication assignment between a matrix and a scalar.
fn mul_assign(&mut self, _rhs: T)
The method for the *=
operator
impl<'a, T: Copy + Mul<T, Output=T>> MulAssign<&'a T> for Matrix<T>
[src]
Performs multiplication assignment between a matrix and a scalar.
fn mul_assign(&mut self, _rhs: &T)
The method for the *=
operator
impl<T: Copy + Add<T, Output=T>> AddAssign<Matrix<T>> for Matrix<T>
[src]
Performs elementwise addition assignment between two matrices.
fn add_assign(&mut self, _rhs: Matrix<T>)
The method for the +=
operator
impl<'a, T: Copy + Add<T, Output=T>> AddAssign<&'a Matrix<T>> for Matrix<T>
[src]
Performs elementwise addition assignment between two matrices.
fn add_assign(&mut self, _rhs: &Matrix<T>)
The method for the +=
operator
impl<T: Copy + Sub<T, Output=T>> SubAssign<Matrix<T>> for Matrix<T>
[src]
Performs elementwise subtraction assignment between two matrices.
fn sub_assign(&mut self, _rhs: Matrix<T>)
The method for the -=
operator
impl<'a, T: Copy + Sub<T, Output=T>> SubAssign<&'a Matrix<T>> for Matrix<T>
[src]
Performs elementwise subtraction assignment between two matrices.
fn sub_assign(&mut self, _rhs: &Matrix<T>)
The method for the -=
operator
impl<'a, T: Copy + Add<T, Output=T>> AddAssign<MatrixSlice<'a, T>> for Matrix<T>
[src]
Performs elementwise addition assignment between two matrices.
fn add_assign(&mut self, _rhs: MatrixSlice<T>)
The method for the +=
operator
impl<'a, 'b, T: Copy + Add<T, Output=T>> AddAssign<&'b MatrixSlice<'a, T>> for Matrix<T>
[src]
Performs elementwise addition assignment between two matrices.
fn add_assign(&mut self, _rhs: &MatrixSlice<T>)
The method for the +=
operator
impl<'a, T: Copy + Sub<T, Output=T>> SubAssign<MatrixSlice<'a, T>> for Matrix<T>
[src]
Performs elementwise subtraction assignment between two matrices.
fn sub_assign(&mut self, _rhs: MatrixSlice<T>)
The method for the -=
operator
impl<'a, 'b, T: Copy + Sub<T, Output=T>> SubAssign<&'b MatrixSlice<'a, T>> for Matrix<T>
[src]
Performs elementwise subtraction assignment between two matrices.
fn sub_assign(&mut self, _rhs: &MatrixSlice<T>)
The method for the -=
operator
impl<'a, T: Copy + Add<T, Output=T>> AddAssign<MatrixSliceMut<'a, T>> for Matrix<T>
[src]
Performs elementwise addition assignment between two matrices.
fn add_assign(&mut self, _rhs: MatrixSliceMut<T>)
The method for the +=
operator
impl<'a, 'b, T: Copy + Add<T, Output=T>> AddAssign<&'b MatrixSliceMut<'a, T>> for Matrix<T>
[src]
Performs elementwise addition assignment between two matrices.
fn add_assign(&mut self, _rhs: &MatrixSliceMut<T>)
The method for the +=
operator
impl<'a, T: Copy + Sub<T, Output=T>> SubAssign<MatrixSliceMut<'a, T>> for Matrix<T>
[src]
Performs elementwise subtraction assignment between two matrices.
fn sub_assign(&mut self, _rhs: MatrixSliceMut<T>)
The method for the -=
operator
impl<'a, 'b, T: Copy + Sub<T, Output=T>> SubAssign<&'b MatrixSliceMut<'a, T>> for Matrix<T>
[src]
Performs elementwise subtraction assignment between two matrices.
fn sub_assign(&mut self, _rhs: &MatrixSliceMut<T>)
The method for the -=
operator
impl<T: Neg<Output=T> + Copy> Neg for Matrix<T>
[src]
Gets negative of matrix.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn neg(self) -> Matrix<T>
The method for the unary -
operator
impl<'a, T: Neg<Output=T> + Copy> Neg for &'a Matrix<T>
[src]
Gets negative of matrix.
type Output = Matrix<T>
The resulting type after applying the -
operator
fn neg(self) -> Matrix<T>
The method for the unary -
operator
impl<'a, T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>> Mul<Matrix<T>> for Matrix<T>
[src]
Multiplies two matrices together.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, m: Matrix<T>) -> Matrix<T>
The method for the *
operator
impl<'a, 'b, T> Mul<&'a Matrix<T>> for Matrix<T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]
Multiplies two matrices together.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, m: &Matrix<T>) -> Matrix<T>
The method for the *
operator
impl<'a, T> Mul<Matrix<T>> for &'a Matrix<T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]
Multiplies two matrices together.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, m: Matrix<T>) -> Matrix<T>
The method for the *
operator
impl<'a, 'b, T> Mul<&'b Matrix<T>> for &'a Matrix<T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]
Multiplies two matrices together.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, m: &Matrix<T>) -> Matrix<T>
The method for the *
operator
impl<'a, T> Mul<MatrixSlice<'a, T>> for Matrix<T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]
Multiplies two matrices together.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, m: MatrixSlice<T>) -> Matrix<T>
The method for the *
operator
impl<'a, 'b, T> Mul<&'b MatrixSlice<'a, T>> for Matrix<T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]
Multiplies two matrices together.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, m: &MatrixSlice<T>) -> Matrix<T>
The method for the *
operator
impl<'a, 'b, T> Mul<MatrixSlice<'a, T>> for &'b Matrix<T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]
Multiplies two matrices together.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, m: MatrixSlice<T>) -> Matrix<T>
The method for the *
operator
impl<'a, 'b, 'c, T> Mul<&'c MatrixSlice<'a, T>> for &'b Matrix<T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]
Multiplies two matrices together.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, m: &MatrixSlice<T>) -> Matrix<T>
The method for the *
operator
impl<'a, T> Mul<MatrixSliceMut<'a, T>> for Matrix<T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]
Multiplies two matrices together.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, m: MatrixSliceMut<T>) -> Matrix<T>
The method for the *
operator
impl<'a, 'b, T> Mul<&'b MatrixSliceMut<'a, T>> for Matrix<T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]
Multiplies two matrices together.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, m: &MatrixSliceMut<T>) -> Matrix<T>
The method for the *
operator
impl<'a, 'b, T> Mul<MatrixSliceMut<'a, T>> for &'b Matrix<T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]
Multiplies two matrices together.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, m: MatrixSliceMut<T>) -> Matrix<T>
The method for the *
operator
impl<'a, 'b, 'c, T> Mul<&'c MatrixSliceMut<'a, T>> for &'b Matrix<T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]
Multiplies two matrices together.
type Output = Matrix<T>
The resulting type after applying the *
operator
fn mul(self, m: &MatrixSliceMut<T>) -> Matrix<T>
The method for the *
operator
impl<'a, T: 'a + Copy> FromIterator<&'a [T]> for Matrix<T>
[src]
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; 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; 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]);
fn from_iter<I: IntoIterator<Item=&'a [T]>>(iterable: I) -> Self
Creates a value from an iterator. Read more
impl<T: Hash> Hash for Matrix<T>
[src]
fn hash<__HT: Hasher>(&self, __arg_0: &mut __HT)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl<T: Eq> Eq for Matrix<T>
[src]
impl<T: PartialEq> PartialEq for Matrix<T>
[src]
fn eq(&self, __arg_0: &Matrix<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Matrix<T>) -> bool
This method tests for !=
.
impl<T: Debug> Debug for Matrix<T>
[src]
impl<T: Clone> Clone for Matrix<T>
[src]
fn clone(&self) -> Matrix<T>
Clones the Matrix.
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T: Float> Metric<T> for Matrix<T>
[src]
fn norm(&self) -> T
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: Display> Display for Matrix<T>
[src]
impl<T> From<Vector<T>> for Matrix<T>
[src]
impl<'a, T: Copy> From<MatrixSlice<'a, T>> for Matrix<T>
[src]
fn from(slice: MatrixSlice<'a, T>) -> Self
Performs the conversion.
impl<'a, T: Copy> From<MatrixSliceMut<'a, T>> for Matrix<T>
[src]
fn from(slice: MatrixSliceMut<'a, T>) -> Self
Performs the conversion.