Struct rusty_machine::linalg::Matrix
source · [−]pub struct Matrix<T> { /* private fields */ }
Expand description
The Matrix
struct.
Can be instantiated with any type.
Implementations
sourceimpl<T> Matrix<T>where
T: Any + Float,
impl<T> Matrix<T>where
T: Any + Float,
sourcepub fn qr_decomp(self) -> Result<(Matrix<T>, Matrix<T>), Error>
👎Deprecated
pub fn qr_decomp(self) -> Result<(Matrix<T>, Matrix<T>), Error>
Compute the QR decomposition of the matrix.
Returns the tuple (Q,R).
Note: this function is deprecated in favor of HouseholderQr and will be removed in a future release.
Examples
use rulinalg::matrix::Matrix;
let m = matrix![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.
sourceimpl<T> Matrix<T>where
T: Any + Float,
impl<T> Matrix<T>where
T: Any + Float,
sourcepub fn cholesky(&self) -> Result<Matrix<T>, Error>
👎Deprecated
pub fn cholesky(&self) -> Result<Matrix<T>, Error>
Cholesky decomposition
Returns the cholesky decomposition of a positive definite matrix.
NOTE: This function is deprecated, and will be removed in a future release. Please see Cholesky for its replacement.
Examples
use rulinalg::matrix::Matrix;
let m = matrix![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.
sourceimpl<T> Matrix<T>where
T: Any + Float,
impl<T> Matrix<T>where
T: Any + Float,
sourcepub fn bidiagonal_decomp(
self
) -> Result<(Matrix<T>, Matrix<T>, Matrix<T>), Error>
pub 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.
sourceimpl<T> Matrix<T>where
T: Any + Float + Signed,
impl<T> Matrix<T>where
T: Any + Float + Signed,
sourcepub fn svd(self) -> Result<(Matrix<T>, Matrix<T>, Matrix<T>), Error>
pub fn svd(self) -> Result<(Matrix<T>, Matrix<T>, Matrix<T>), Error>
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 NU
: M x NV
: N x N
If M < N:
Σ
: M x MU
: M x MV
: 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.
sourceimpl<T> Matrix<T>where
T: Any + Float,
impl<T> Matrix<T>where
T: Any + Float,
sourcepub fn upper_hessenberg(self) -> Result<Matrix<T>, Error>
pub 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![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."));
Panics
- The matrix is not square.
Failures
- The matrix cannot be reduced to upper hessenberg form.
sourcepub fn upper_hess_decomp(self) -> Result<(Matrix<T>, Matrix<T>), Error>
pub 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::BaseMatrix;
let a = matrix![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!");
assert_matrix_eq!(h, u.transpose() * a * u, comp = abs, tol = 1e-12);
Panics
- The matrix is not square.
Failures
- The matrix cannot be reduced to upper hessenberg form.
sourceimpl<T> Matrix<T>where
T: Any + Float,
impl<T> Matrix<T>where
T: Any + Float,
sourcepub fn lup_decomp(self) -> Result<(Matrix<T>, Matrix<T>, Matrix<T>), Error>
👎Deprecated
pub 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.
This function is deprecated. Please see PartialPivLu for a replacement.
Examples
use rulinalg::matrix::Matrix;
let a = matrix![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.
sourceimpl<T> Matrix<T>where
T: Any + Float + Signed,
impl<T> Matrix<T>where
T: Any + Float + Signed,
sourcepub fn eigenvalues(self) -> Result<Vec<T, Global>, Error>
pub fn eigenvalues(self) -> Result<Vec<T, Global>, 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.
sourcepub fn eigendecomp(self) -> Result<(Vec<T, Global>, Matrix<T>), Error>
pub fn eigendecomp(self) -> Result<(Vec<T, Global>, 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![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.
sourceimpl<T> Matrix<T>
impl<T> Matrix<T>
sourcepub fn from_fn<F>(rows: usize, cols: usize, f: F) -> Matrix<T>where
F: FnMut(usize, usize) -> T,
pub fn from_fn<F>(rows: usize, cols: usize, f: F) -> Matrix<T>where
F: FnMut(usize, usize) -> T,
Constructor for Matrix struct that takes a function f
and constructs a new matrix such that A_ij = f(j, i)
,
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,
]);
Warning
This function will be changed in a future release so that A_ij = f(i, j)
- to be consistent
with the rest of the library.
sourceimpl<T> Matrix<T>where
T: Clone + Zero,
impl<T> Matrix<T>where
T: Clone + Zero,
sourceimpl<T> Matrix<T>where
T: Float + FromPrimitive,
impl<T> Matrix<T>where
T: Float + FromPrimitive,
sourcepub fn mean(&self, axis: Axes) -> Vector<T>
pub 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.
Calling mean()
on an empty matrix will return an empty matrix.
Examples
use rulinalg::matrix::{Matrix, Axes};
let a = matrix![1.0, 2.0;
3.0, 4.0];
let c = a.mean(Axes::Row);
assert_eq!(c, vector![2.0, 3.0]);
let d = a.mean(Axes::Col);
assert_eq!(d, vector![1.5, 3.5]);
sourcepub fn variance(&self, axis: Axes) -> Result<Vector<T>, Error>
pub fn variance(&self, axis: Axes) -> Result<Vector<T>, Error>
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![1.0, 2.0;
3.0, 4.0];
let c = a.variance(Axes::Row).unwrap();
assert_eq!(c, vector![2.0, 2.0]);
let d = a.variance(Axes::Col).unwrap();
assert_eq!(d, vector![0.5, 0.5]);
Failures
- There are one or fewer row/columns in the working axis.
sourceimpl<T> Matrix<T>where
T: Any + Float,
impl<T> Matrix<T>where
T: Any + Float,
sourcepub fn solve(self, y: Vector<T>) -> Result<Vector<T>, Error>
pub fn solve(self, y: Vector<T>) -> Result<Vector<T>, Error>
Solves the equation Ax = y
.
Requires a Vector y
as input.
The method performs an LU decomposition internally, consuming the matrix in the process. If solving the same system for multiple right-hand sides is desired, see PartialPivLu.
Examples
use rulinalg::matrix::Matrix;
use rulinalg::vector::Vector;
let a = matrix![2.0, 3.0;
1.0, 2.0];
let y = vector![13.0, 8.0];
let x = a.solve(y).unwrap();
assert_eq!(x, vector![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.
sourcepub fn inverse(self) -> Result<Matrix<T>, Error>
pub fn inverse(self) -> Result<Matrix<T>, Error>
Computes the inverse of the matrix.
Internally performs an LU decomposition.
Examples
use rulinalg::matrix::Matrix;
let a = matrix![2., 3.;
1., 2.];
let inv = a.clone().inverse().expect("This matrix should have an inverse!");
let I = a * inv;
assert_matrix_eq!(I, matrix![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.
Trait Implementations
sourceimpl<'a, T> Add<&'a Matrix<T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
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
.
sourceimpl<'a, T> Add<&'a T> for Matrix<T>where
T: Copy + Add<T, Output = T>,
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.
sourceimpl<'a, 'b, T> Add<&'b Matrix<T>> for &'a Matrix<T>where
T: Copy + Add<T, Output = T>,
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.
sourceimpl<'a, 'b, T> Add<&'b Matrix<T>> for MatrixSlice<'a, T>where
T: Copy + Add<T, Output = T>,
impl<'a, 'b, T> Add<&'b Matrix<T>> for MatrixSlice<'a, T>where
T: Copy + Add<T, Output = T>,
Performs elementwise
addition
between Matrix
and MatrixSlice
.
sourceimpl<'a, 'b, T> Add<&'b Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Add<T, Output = T>,
impl<'a, 'b, T> Add<&'b Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Add<T, Output = T>,
Performs elementwise
addition
between Matrix
and MatrixSlice
.
sourceimpl<'a, 'b, T> Add<&'b MatrixSlice<'a, T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
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
.
sourceimpl<'a, 'b, T> Add<&'b MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
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
.
sourceimpl<'a, 'b, T> Add<&'b T> for &'a Matrix<T>where
T: Copy + Add<T, Output = T>,
impl<'a, 'b, T> Add<&'b T> for &'a Matrix<T>where
T: Copy + Add<T, Output = T>,
Scalar addition with matrix.
sourceimpl<'a, 'b, 'c, T> Add<&'c Matrix<T>> for &'b MatrixSlice<'a, T>where
T: Copy + Add<T, Output = T>,
impl<'a, 'b, 'c, T> Add<&'c Matrix<T>> for &'b MatrixSlice<'a, T>where
T: Copy + Add<T, Output = T>,
Performs elementwise
addition
between Matrix
and MatrixSlice
.
sourceimpl<'a, 'b, 'c, T> Add<&'c Matrix<T>> for &'b MatrixSliceMut<'a, T>where
T: Copy + Add<T, Output = T>,
impl<'a, 'b, 'c, T> Add<&'c Matrix<T>> for &'b MatrixSliceMut<'a, T>where
T: Copy + Add<T, Output = T>,
Performs elementwise
addition
between Matrix
and MatrixSlice
.
sourceimpl<'a, 'b, 'c, T> Add<&'c MatrixSlice<'a, T>> for &'b Matrix<T>where
T: Copy + Add<T, Output = T>,
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
.
sourceimpl<'a, 'b, 'c, T> Add<&'c MatrixSliceMut<'a, T>> for &'b Matrix<T>where
T: Copy + Add<T, Output = T>,
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
.
sourceimpl<'a, T> Add<Matrix<T>> for &'a Matrix<T>where
T: Copy + Add<T, Output = T>,
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
.
sourceimpl<'a, 'b, T> Add<Matrix<T>> for &'b MatrixSlice<'a, T>where
T: Copy + Add<T, Output = T>,
impl<'a, 'b, T> Add<Matrix<T>> for &'b MatrixSlice<'a, T>where
T: Copy + Add<T, Output = T>,
Performs elementwise
addition
between Matrix
and MatrixSlice
.
sourceimpl<'a, 'b, T> Add<Matrix<T>> for &'b MatrixSliceMut<'a, T>where
T: Copy + Add<T, Output = T>,
impl<'a, 'b, T> Add<Matrix<T>> for &'b MatrixSliceMut<'a, T>where
T: Copy + Add<T, Output = T>,
Performs elementwise
addition
between Matrix
and MatrixSlice
.
sourceimpl<T> Add<Matrix<T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
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
.
sourceimpl<'a, T> Add<Matrix<T>> for MatrixSlice<'a, T>where
T: Copy + Add<T, Output = T>,
impl<'a, T> Add<Matrix<T>> for MatrixSlice<'a, T>where
T: Copy + Add<T, Output = T>,
Performs elementwise
addition
between Matrix
and MatrixSlice
.
sourceimpl<'a, T> Add<Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Add<T, Output = T>,
impl<'a, T> Add<Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Add<T, Output = T>,
Performs elementwise
addition
between Matrix
and MatrixSlice
.
sourceimpl<'a, 'b, T> Add<MatrixSlice<'a, T>> for &'b Matrix<T>where
T: Copy + Add<T, Output = T>,
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
.
sourceimpl<'a, T> Add<MatrixSlice<'a, T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
impl<'a, T> Add<MatrixSlice<'a, T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
Performs elementwise
addition
between Matrix
and MatrixSlice
.
sourceimpl<'a, 'b, T> Add<MatrixSliceMut<'a, T>> for &'b Matrix<T>where
T: Copy + Add<T, Output = T>,
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
.
sourceimpl<'a, T> Add<MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
impl<'a, T> Add<MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
Performs elementwise
addition
between Matrix
and MatrixSlice
.
sourceimpl<'a, T> Add<T> for &'a Matrix<T>where
T: Copy + Add<T, Output = T>,
impl<'a, T> Add<T> for &'a Matrix<T>where
T: Copy + Add<T, Output = T>,
Scalar addition with matrix.
sourceimpl<T> Add<T> for Matrix<T>where
T: Copy + Add<T, Output = T>,
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.
sourceimpl<'a, T> AddAssign<&'a Matrix<T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
impl<'a, T> AddAssign<&'a Matrix<T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
Performs elementwise addition assignment between two matrices.
sourcefn add_assign(&mut self, _rhs: &Matrix<T>)
fn add_assign(&mut self, _rhs: &Matrix<T>)
+=
operation. Read moresourceimpl<'a, T> AddAssign<&'a T> for Matrix<T>where
T: Copy + Add<T, Output = T>,
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.
sourcefn add_assign(&mut self, _rhs: &T)
fn add_assign(&mut self, _rhs: &T)
+=
operation. Read moresourceimpl<'a, 'b, T> AddAssign<&'b Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Add<T, Output = T>,
impl<'a, 'b, T> AddAssign<&'b Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Add<T, Output = T>,
Performs elementwise addition assignment between two matrices.
sourcefn add_assign(&mut self, _rhs: &Matrix<T>)
fn add_assign(&mut self, _rhs: &Matrix<T>)
+=
operation. Read moresourceimpl<'a, 'b, T> AddAssign<&'b MatrixSlice<'a, T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
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.
sourcefn add_assign(&mut self, _rhs: &MatrixSlice<'_, T>)
fn add_assign(&mut self, _rhs: &MatrixSlice<'_, T>)
+=
operation. Read moresourceimpl<'a, 'b, T> AddAssign<&'b MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
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.
sourcefn add_assign(&mut self, _rhs: &MatrixSliceMut<'_, T>)
fn add_assign(&mut self, _rhs: &MatrixSliceMut<'_, T>)
+=
operation. Read moresourceimpl<T> AddAssign<Matrix<T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
impl<T> AddAssign<Matrix<T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
Performs elementwise addition assignment between two matrices.
sourcefn add_assign(&mut self, _rhs: Matrix<T>)
fn add_assign(&mut self, _rhs: Matrix<T>)
+=
operation. Read moresourceimpl<'a, T> AddAssign<Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Add<T, Output = T>,
impl<'a, T> AddAssign<Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Add<T, Output = T>,
Performs elementwise addition assignment between two matrices.
sourcefn add_assign(&mut self, _rhs: Matrix<T>)
fn add_assign(&mut self, _rhs: Matrix<T>)
+=
operation. Read moresourceimpl<'a, T> AddAssign<MatrixSlice<'a, T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
impl<'a, T> AddAssign<MatrixSlice<'a, T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
Performs elementwise addition assignment between two matrices.
sourcefn add_assign(&mut self, _rhs: MatrixSlice<'_, T>)
fn add_assign(&mut self, _rhs: MatrixSlice<'_, T>)
+=
operation. Read moresourceimpl<'a, T> AddAssign<MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
impl<'a, T> AddAssign<MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy + Add<T, Output = T>,
Performs elementwise addition assignment between two matrices.
sourcefn add_assign(&mut self, _rhs: MatrixSliceMut<'_, T>)
fn add_assign(&mut self, _rhs: MatrixSliceMut<'_, T>)
+=
operation. Read moresourceimpl<T> AddAssign<T> for Matrix<T>where
T: Copy + Add<T, Output = T>,
impl<T> AddAssign<T> for Matrix<T>where
T: Copy + Add<T, Output = T>,
Performs addition assignment between a matrix and a scalar.
sourcefn add_assign(&mut self, _rhs: T)
fn add_assign(&mut self, _rhs: T)
+=
operation. Read moresourceimpl<T> BaseMatrix<T> for Matrix<T>
impl<T> BaseMatrix<T> for Matrix<T>
sourcefn row_stride(&self) -> usize
fn row_stride(&self) -> usize
sourcefn into_matrix(self) -> Matrix<T>where
T: Copy,
fn into_matrix(self) -> Matrix<T>where
T: Copy,
sourcefn sum(&self) -> Twhere
T: Copy + Zero<Output = T> + Add<T>,
fn sum(&self) -> Twhere
T: Copy + Zero<Output = T> + Add<T>,
sourcefn elemul(&self, m: &Matrix<T>) -> Matrix<T>where
T: Copy + Mul<T, Output = T>,
fn elemul(&self, m: &Matrix<T>) -> Matrix<T>where
T: Copy + Mul<T, Output = T>,
sourcefn elediv(&self, m: &Matrix<T>) -> Matrix<T>where
T: Copy + Div<T, Output = T>,
fn elediv(&self, m: &Matrix<T>) -> Matrix<T>where
T: Copy + Div<T, Output = T>,
sourcefn vcat<S>(&self, m: &S) -> Matrix<T>where
T: Copy,
S: BaseMatrix<T>,
fn vcat<S>(&self, m: &S) -> Matrix<T>where
T: Copy,
S: BaseMatrix<T>,
sourcefn as_slice(&self) -> MatrixSlice<'_, T>
fn as_slice(&self) -> MatrixSlice<'_, T>
MatrixSlice
over the whole matrix. Read moresourceunsafe fn get_unchecked(&self, index: [usize; 2]) -> &T
unsafe fn get_unchecked(&self, index: [usize; 2]) -> &T
sourcefn get(&self, index: [usize; 2]) -> Option<&T>
fn get(&self, index: [usize; 2]) -> Option<&T>
sourcefn col(&self, index: usize) -> Column<'_, T>
fn col(&self, index: usize) -> Column<'_, T>
None
if the index is out of bounds. Read moresourceunsafe fn col_unchecked(&self, index: usize) -> Column<'_, T>
unsafe fn col_unchecked(&self, index: usize) -> Column<'_, T>
sourcefn row(&self, index: usize) -> Row<'_, T>
fn row(&self, index: usize) -> Row<'_, T>
sourceunsafe fn row_unchecked(&self, index: usize) -> Row<'_, T>
unsafe fn row_unchecked(&self, index: usize) -> Row<'_, T>
sourcefn iter<'a>(&self) -> SliceIter<'a, T>where
T: 'a,
fn iter<'a>(&self) -> SliceIter<'a, T>where
T: 'a,
sourcefn diag_iter(&self, k: DiagOffset) -> Diagonal<'_, T, Self>
fn diag_iter(&self, k: DiagOffset) -> Diagonal<'_, T, Self>
sourcefn metric<'a, 'b, B, M>(&'a self, mat: &'b B, metric: M) -> Twhere
B: 'b + BaseMatrix<T>,
M: MatrixMetric<'a, 'b, T, Self, B>,
fn metric<'a, 'b, B, M>(&'a self, mat: &'b B, metric: M) -> Twhere
B: 'b + BaseMatrix<T>,
M: MatrixMetric<'a, 'b, T, Self, B>,
sourcefn split_at(
&self,
mid: usize,
axis: Axes
) -> (MatrixSlice<'_, T>, MatrixSlice<'_, T>)
fn split_at(
&self,
mid: usize,
axis: Axes
) -> (MatrixSlice<'_, T>, MatrixSlice<'_, T>)
MatrixSlice
s. Read moresourcefn sub_slice<'a>(
&self,
start: [usize; 2],
rows: usize,
cols: usize
) -> MatrixSlice<'a, T>where
T: 'a,
fn sub_slice<'a>(
&self,
start: [usize; 2],
rows: usize,
cols: usize
) -> MatrixSlice<'a, T>where
T: 'a,
MatrixSlice
from an existing matrix. Read moresourceimpl<T> BaseMatrixMut<T> for Matrix<T>
impl<T> BaseMatrixMut<T> for Matrix<T>
sourcefn as_mut_ptr(&mut self) -> *mut T
fn as_mut_ptr(&mut self) -> *mut T
Top left index of the slice.
sourcefn as_mut_slice(&mut self) -> MatrixSliceMut<'_, T>
fn as_mut_slice(&mut self) -> MatrixSliceMut<'_, T>
MatrixSliceMut
over the whole matrix. Read moresourceunsafe fn get_unchecked_mut(&mut self, index: [usize; 2]) -> &mut T
unsafe fn get_unchecked_mut(&mut self, index: [usize; 2]) -> &mut T
sourcefn get_mut(&mut self, index: [usize; 2]) -> Option<&mut T>
fn get_mut(&mut self, index: [usize; 2]) -> Option<&mut T>
sourcefn iter_mut<'a>(&mut self) -> SliceIterMut<'a, T>where
T: 'a,
fn iter_mut<'a>(&mut self) -> SliceIterMut<'a, T>where
T: 'a,
sourcefn col_mut(&mut self, index: usize) -> ColumnMut<'_, T>
fn col_mut(&mut self, index: usize) -> ColumnMut<'_, T>
None
if the index is out of bounds. Read moresourceunsafe fn col_unchecked_mut(&mut self, index: usize) -> ColumnMut<'_, T>
unsafe fn col_unchecked_mut(&mut self, index: usize) -> ColumnMut<'_, T>
sourcefn row_mut(&mut self, index: usize) -> RowMut<'_, T>
fn row_mut(&mut self, index: usize) -> RowMut<'_, T>
None
if the index is out of bounds. Read moresourceunsafe fn row_unchecked_mut(&mut self, index: usize) -> RowMut<'_, T>
unsafe fn row_unchecked_mut(&mut self, index: usize) -> RowMut<'_, T>
sourcefn col_iter_mut(&mut self) -> ColsMut<'_, T>
fn col_iter_mut(&mut self) -> ColsMut<'_, T>
sourcefn row_iter_mut(&mut self) -> RowsMut<'_, T>
fn row_iter_mut(&mut self) -> RowsMut<'_, T>
sourcefn diag_iter_mut(&mut self, k: DiagOffset) -> DiagonalMut<'_, T, Self>
fn diag_iter_mut(&mut self, k: DiagOffset) -> DiagonalMut<'_, T, Self>
sourcefn split_at_mut(
&mut self,
mid: usize,
axis: Axes
) -> (MatrixSliceMut<'_, T>, MatrixSliceMut<'_, T>)
fn split_at_mut(
&mut self,
mid: usize,
axis: Axes
) -> (MatrixSliceMut<'_, T>, MatrixSliceMut<'_, T>)
MatrixSliceMut
s. Read moresourcefn sub_slice_mut<'a>(
&mut self,
start: [usize; 2],
rows: usize,
cols: usize
) -> MatrixSliceMut<'a, T>where
T: 'a,
fn sub_slice_mut<'a>(
&mut self,
start: [usize; 2],
rows: usize,
cols: usize
) -> MatrixSliceMut<'a, T>where
T: 'a,
MatrixSliceMut
from an existing matrix. Read moresourceimpl CostFunc<Matrix<f64>> for CrossEntropyError
impl CostFunc<Matrix<f64>> for CrossEntropyError
sourceimpl CostFunc<Matrix<f64>> for MeanSqError
impl CostFunc<Matrix<f64>> for MeanSqError
sourceimpl<'a, T> Div<&'a T> for Matrix<T>where
T: Copy + Div<T, Output = T>,
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.
sourceimpl<'a, 'b, T> Div<&'b T> for &'a Matrix<T>where
T: Copy + Div<T, Output = T>,
impl<'a, 'b, T> Div<&'b T> for &'a Matrix<T>where
T: Copy + Div<T, Output = T>,
Scalar division with matrix.
sourceimpl<'a, T> Div<T> for &'a Matrix<T>where
T: Copy + Div<T, Output = T>,
impl<'a, T> Div<T> for &'a Matrix<T>where
T: Copy + Div<T, Output = T>,
Scalar division with matrix.
sourceimpl<T> Div<T> for Matrix<T>where
T: Copy + Div<T, Output = T>,
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.
sourceimpl<'a, T> DivAssign<&'a T> for Matrix<T>where
T: Copy + Div<T, Output = T>,
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.
sourcefn div_assign(&mut self, _rhs: &T)
fn div_assign(&mut self, _rhs: &T)
/=
operation. Read moresourceimpl<T> DivAssign<T> for Matrix<T>where
T: Copy + Div<T, Output = T>,
impl<T> DivAssign<T> for Matrix<T>where
T: Copy + Div<T, Output = T>,
Performs division assignment between a matrix and a scalar.
sourcefn div_assign(&mut self, _rhs: T)
fn div_assign(&mut self, _rhs: T)
/=
operation. Read moresourceimpl<'a, T> From<MatrixSlice<'a, T>> for Matrix<T>where
T: Copy,
impl<'a, T> From<MatrixSlice<'a, T>> for Matrix<T>where
T: Copy,
sourcefn from(slice: MatrixSlice<'a, T>) -> Matrix<T>
fn from(slice: MatrixSlice<'a, T>) -> Matrix<T>
sourceimpl<'a, T> From<MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy,
impl<'a, T> From<MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy,
sourcefn from(slice: MatrixSliceMut<'a, T>) -> Matrix<T>
fn from(slice: MatrixSliceMut<'a, T>) -> Matrix<T>
sourceimpl<'a, T> FromIterator<&'a [T]> for Matrix<T>where
T: 'a + Copy,
impl<'a, T> FromIterator<&'a [T]> for Matrix<T>where
T: 'a + Copy,
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.row_iter()
.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]);
sourceimpl<T> Hash for Matrix<T>where
T: Hash,
impl<T> Hash for Matrix<T>where
T: Hash,
sourcefn hash<__H>(&self, state: &mut __H)where
__H: Hasher,
fn hash<__H>(&self, state: &mut __H)where
__H: Hasher,
Hasher
]. Read more1.3.0fn hash_slice<H>(data: &[Self], state: &mut H)where
H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H)where
H: Hasher,
Hasher
]. Read moresourceimpl<T> IndexMut<[usize; 2]> for Matrix<T>
impl<T> IndexMut<[usize; 2]> for Matrix<T>
Indexes mutable matrix.
Takes row index first then column.
sourceimpl<T: Float> Invertible<Matrix<T>> for MinMaxScaler<T>
impl<T: Float> Invertible<Matrix<T>> for MinMaxScaler<T>
sourcefn inv_transform(&self, inputs: Matrix<T>) -> Result<Matrix<T>, Error>
fn inv_transform(&self, inputs: Matrix<T>) -> Result<Matrix<T>, Error>
sourceimpl<T: Float + FromPrimitive> Invertible<Matrix<T>> for Standardizer<T>
impl<T: Float + FromPrimitive> Invertible<Matrix<T>> for Standardizer<T>
sourcefn inv_transform(&self, inputs: Matrix<T>) -> LearningResult<Matrix<T>>
fn inv_transform(&self, inputs: Matrix<T>) -> LearningResult<Matrix<T>>
sourceimpl<'a, 'b, T> Mul<&'a Matrix<T>> for Matrix<T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
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.
sourceimpl<'a, T> Mul<&'a PermutationMatrix<T>> for Matrix<T>where
T: Clone,
impl<'a, T> Mul<&'a PermutationMatrix<T>> for Matrix<T>where
T: Clone,
Right-multiply a matrix by a permutation matrix.
sourceimpl<'a, T> Mul<&'a T> for Matrix<T>where
T: Copy + Mul<T, Output = T>,
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.
sourceimpl<'a, T> Mul<&'a Vector<T>> for Matrix<T>where
T: Zero<Output = T> + Mul<T, Output = T> + Add<T> + Copy,
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.
sourceimpl<'a, 'b, T> Mul<&'b Matrix<T>> for &'a Matrix<T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
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.
sourceimpl<'a, 'b, T> Mul<&'b Matrix<T>> for MatrixSlice<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
impl<'a, 'b, T> Mul<&'b Matrix<T>> for MatrixSlice<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
Multiplies two matrices together.
sourceimpl<'a, 'b, T> Mul<&'b Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
impl<'a, 'b, T> Mul<&'b Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
Multiplies two matrices together.
sourceimpl<'a, 'b, T> Mul<&'b MatrixSlice<'a, T>> for Matrix<T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
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.
sourceimpl<'a, 'b, T> Mul<&'b MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
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.
sourceimpl<'a, 'b, 'm, T> Mul<&'b PermutationMatrix<T>> for &'a Matrix<T>where
T: Zero + Clone,
impl<'a, 'b, 'm, T> Mul<&'b PermutationMatrix<T>> for &'a Matrix<T>where
T: Zero + Clone,
Right-multiply a matrix by a permutation matrix.
sourceimpl<'a, 'b, T> Mul<&'b T> for &'a Matrix<T>where
T: Copy + Mul<T, Output = T>,
impl<'a, 'b, T> Mul<&'b T> for &'a Matrix<T>where
T: Copy + Mul<T, Output = T>,
Scalar multiplication with matrix.
sourceimpl<'a, 'b, T> Mul<&'b Vector<T>> for &'a Matrix<T>where
T: Zero<Output = T> + Mul<T, Output = T> + Add<T> + Copy,
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.
sourceimpl<'a, 'b, 'c, T> Mul<&'c Matrix<T>> for &'b MatrixSlice<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
impl<'a, 'b, 'c, T> Mul<&'c Matrix<T>> for &'b MatrixSlice<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
Multiplies two matrices together.
sourceimpl<'a, 'b, 'c, T> Mul<&'c Matrix<T>> for &'b MatrixSliceMut<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
impl<'a, 'b, 'c, T> Mul<&'c Matrix<T>> for &'b MatrixSliceMut<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
Multiplies two matrices together.
sourceimpl<'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,
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.
sourceimpl<'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,
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.
sourceimpl<'a, T> Mul<Matrix<T>> for &'a Matrix<T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
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.
sourceimpl<'a, 'b, T> Mul<Matrix<T>> for &'b MatrixSlice<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
impl<'a, 'b, T> Mul<Matrix<T>> for &'b MatrixSlice<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
Multiplies two matrices together.
sourceimpl<'a, 'b, T> Mul<Matrix<T>> for &'b MatrixSliceMut<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
impl<'a, 'b, T> Mul<Matrix<T>> for &'b MatrixSliceMut<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
Multiplies two matrices together.
sourceimpl<'a, T> Mul<Matrix<T>> for Matrix<T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
impl<'a, T> Mul<Matrix<T>> for Matrix<T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
Multiplies two matrices together.
sourceimpl<'a, T> Mul<Matrix<T>> for MatrixSlice<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
impl<'a, T> Mul<Matrix<T>> for MatrixSlice<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
Multiplies two matrices together.
sourceimpl<'a, T> Mul<Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
impl<'a, T> Mul<Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
Multiplies two matrices together.
sourceimpl<'a, 'b, T> Mul<MatrixSlice<'a, T>> for &'b Matrix<T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
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.
sourceimpl<'a, T> Mul<MatrixSlice<'a, T>> for Matrix<T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
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.
sourceimpl<'a, 'b, T> Mul<MatrixSliceMut<'a, T>> for &'b Matrix<T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
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.
sourceimpl<'a, T> Mul<MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy + Zero<Output = T> + Add<T> + Mul<T, Output = T> + Any,
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.
sourceimpl<'a, 'm, T> Mul<PermutationMatrix<T>> for &'a Matrix<T>where
T: Zero + Clone,
impl<'a, 'm, T> Mul<PermutationMatrix<T>> for &'a Matrix<T>where
T: Zero + Clone,
Right-multiply a matrix by a permutation matrix.
sourceimpl<T> Mul<PermutationMatrix<T>> for Matrix<T>
impl<T> Mul<PermutationMatrix<T>> for Matrix<T>
Right-multiply a matrix by a permutation matrix.
sourceimpl<'a, T> Mul<T> for &'a Matrix<T>where
T: Copy + Mul<T, Output = T>,
impl<'a, T> Mul<T> for &'a Matrix<T>where
T: Copy + Mul<T, Output = T>,
Scalar multiplication with matrix.
sourceimpl<T> Mul<T> for Matrix<T>where
T: Copy + Mul<T, Output = T>,
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.
sourceimpl<'a, T> Mul<Vector<T>> for &'a Matrix<T>where
T: Zero<Output = T> + Mul<T, Output = T> + Add<T> + Copy,
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.
sourceimpl<T> Mul<Vector<T>> for Matrix<T>where
T: Zero<Output = T> + Mul<T, Output = T> + Add<T> + Copy,
impl<T> Mul<Vector<T>> for Matrix<T>where
T: Zero<Output = T> + Mul<T, Output = T> + Add<T> + Copy,
Multiplies matrix by vector.
sourceimpl<'a, T> MulAssign<&'a T> for Matrix<T>where
T: Copy + Mul<T, Output = T>,
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.
sourcefn mul_assign(&mut self, _rhs: &T)
fn mul_assign(&mut self, _rhs: &T)
*=
operation. Read moresourceimpl<T> MulAssign<T> for Matrix<T>where
T: Copy + Mul<T, Output = T>,
impl<T> MulAssign<T> for Matrix<T>where
T: Copy + Mul<T, Output = T>,
Performs multiplication assignment between a matrix and a scalar.
sourcefn mul_assign(&mut self, _rhs: T)
fn mul_assign(&mut self, _rhs: T)
*=
operation. Read moresourceimpl<T> PartialEq<Matrix<T>> for Matrix<T>where
T: PartialEq<T>,
impl<T> PartialEq<Matrix<T>> for Matrix<T>where
T: PartialEq<T>,
sourceimpl<'a, T> Sub<&'a Matrix<T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
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
.
sourceimpl<'a, T> Sub<&'a T> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
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.
sourceimpl<'a, 'b, T> Sub<&'b Matrix<T>> for &'a Matrix<T>where
T: Copy + Sub<T, Output = T>,
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.
sourceimpl<'a, 'b, T> Sub<&'b Matrix<T>> for MatrixSlice<'a, T>where
T: Copy + Sub<T, Output = T>,
impl<'a, 'b, T> Sub<&'b Matrix<T>> for MatrixSlice<'a, T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
sourceimpl<'a, 'b, T> Sub<&'b Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Sub<T, Output = T>,
impl<'a, 'b, T> Sub<&'b Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
sourceimpl<'a, 'b, T> Sub<&'b MatrixSlice<'a, T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
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
.
sourceimpl<'a, 'b, T> Sub<&'b MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
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
.
sourceimpl<'a, 'b, T> Sub<&'b T> for &'a Matrix<T>where
T: Copy + Sub<T, Output = T>,
impl<'a, 'b, T> Sub<&'b T> for &'a Matrix<T>where
T: Copy + Sub<T, Output = T>,
Scalar subtraction with matrix.
sourceimpl<'a, 'b, 'c, T> Sub<&'c Matrix<T>> for &'b MatrixSlice<'a, T>where
T: Copy + Sub<T, Output = T>,
impl<'a, 'b, 'c, T> Sub<&'c Matrix<T>> for &'b MatrixSlice<'a, T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
sourceimpl<'a, 'b, 'c, T> Sub<&'c Matrix<T>> for &'b MatrixSliceMut<'a, T>where
T: Copy + Sub<T, Output = T>,
impl<'a, 'b, 'c, T> Sub<&'c Matrix<T>> for &'b MatrixSliceMut<'a, T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
sourceimpl<'a, 'b, 'c, T> Sub<&'c MatrixSlice<'a, T>> for &'b Matrix<T>where
T: Copy + Sub<T, Output = T>,
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
.
sourceimpl<'a, 'b, 'c, T> Sub<&'c MatrixSliceMut<'a, T>> for &'b Matrix<T>where
T: Copy + Sub<T, Output = T>,
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
.
sourceimpl<'a, T> Sub<Matrix<T>> for &'a Matrix<T>where
T: Copy + Sub<T, Output = T>,
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
.
sourceimpl<'a, 'b, T> Sub<Matrix<T>> for &'b MatrixSlice<'a, T>where
T: Copy + Sub<T, Output = T>,
impl<'a, 'b, T> Sub<Matrix<T>> for &'b MatrixSlice<'a, T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
sourceimpl<'a, 'b, T> Sub<Matrix<T>> for &'b MatrixSliceMut<'a, T>where
T: Copy + Sub<T, Output = T>,
impl<'a, 'b, T> Sub<Matrix<T>> for &'b MatrixSliceMut<'a, T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
sourceimpl<T> Sub<Matrix<T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
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
.
sourceimpl<'a, T> Sub<Matrix<T>> for MatrixSlice<'a, T>where
T: Copy + Sub<T, Output = T>,
impl<'a, T> Sub<Matrix<T>> for MatrixSlice<'a, T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
sourceimpl<'a, T> Sub<Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Sub<T, Output = T>,
impl<'a, T> Sub<Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
sourceimpl<'a, 'b, T> Sub<MatrixSlice<'a, T>> for &'b Matrix<T>where
T: Copy + Sub<T, Output = T>,
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
.
sourceimpl<'a, T> Sub<MatrixSlice<'a, T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
impl<'a, T> Sub<MatrixSlice<'a, T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
sourceimpl<'a, 'b, T> Sub<MatrixSliceMut<'a, T>> for &'b Matrix<T>where
T: Copy + Sub<T, Output = T>,
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
.
sourceimpl<'a, T> Sub<MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
impl<'a, T> Sub<MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise
subtraction
between Matrix
and MatrixSlice
.
sourceimpl<'a, T> Sub<T> for &'a Matrix<T>where
T: Copy + Sub<T, Output = T>,
impl<'a, T> Sub<T> for &'a Matrix<T>where
T: Copy + Sub<T, Output = T>,
Scalar subtraction with matrix.
sourceimpl<T> Sub<T> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
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.
sourceimpl<'a, T> SubAssign<&'a Matrix<T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
impl<'a, T> SubAssign<&'a Matrix<T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise subtraction assignment between two matrices.
sourcefn sub_assign(&mut self, _rhs: &Matrix<T>)
fn sub_assign(&mut self, _rhs: &Matrix<T>)
-=
operation. Read moresourceimpl<'a, T> SubAssign<&'a T> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
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.
sourcefn sub_assign(&mut self, _rhs: &T)
fn sub_assign(&mut self, _rhs: &T)
-=
operation. Read moresourceimpl<'a, 'b, T> SubAssign<&'b Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Sub<T, Output = T>,
impl<'a, 'b, T> SubAssign<&'b Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise subtraction assignment between two matrices.
sourcefn sub_assign(&mut self, _rhs: &Matrix<T>)
fn sub_assign(&mut self, _rhs: &Matrix<T>)
-=
operation. Read moresourceimpl<'a, 'b, T> SubAssign<&'b MatrixSlice<'a, T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
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.
sourcefn sub_assign(&mut self, _rhs: &MatrixSlice<'_, T>)
fn sub_assign(&mut self, _rhs: &MatrixSlice<'_, T>)
-=
operation. Read moresourceimpl<'a, 'b, T> SubAssign<&'b MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
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.
sourcefn sub_assign(&mut self, _rhs: &MatrixSliceMut<'_, T>)
fn sub_assign(&mut self, _rhs: &MatrixSliceMut<'_, T>)
-=
operation. Read moresourceimpl<T> SubAssign<Matrix<T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
impl<T> SubAssign<Matrix<T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise subtraction assignment between two matrices.
sourcefn sub_assign(&mut self, _rhs: Matrix<T>)
fn sub_assign(&mut self, _rhs: Matrix<T>)
-=
operation. Read moresourceimpl<'a, T> SubAssign<Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Sub<T, Output = T>,
impl<'a, T> SubAssign<Matrix<T>> for MatrixSliceMut<'a, T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise subtraction assignment between two matrices.
sourcefn sub_assign(&mut self, _rhs: Matrix<T>)
fn sub_assign(&mut self, _rhs: Matrix<T>)
-=
operation. Read moresourceimpl<'a, T> SubAssign<MatrixSlice<'a, T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
impl<'a, T> SubAssign<MatrixSlice<'a, T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise subtraction assignment between two matrices.
sourcefn sub_assign(&mut self, _rhs: MatrixSlice<'_, T>)
fn sub_assign(&mut self, _rhs: MatrixSlice<'_, T>)
-=
operation. Read moresourceimpl<'a, T> SubAssign<MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
impl<'a, T> SubAssign<MatrixSliceMut<'a, T>> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
Performs elementwise subtraction assignment between two matrices.
sourcefn sub_assign(&mut self, _rhs: MatrixSliceMut<'_, T>)
fn sub_assign(&mut self, _rhs: MatrixSliceMut<'_, T>)
-=
operation. Read moresourceimpl<T> SubAssign<T> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
impl<T> SubAssign<T> for Matrix<T>where
T: Copy + Sub<T, Output = T>,
Performs subtraction assignment between a matrix and a scalar.
sourcefn sub_assign(&mut self, _rhs: T)
fn sub_assign(&mut self, _rhs: T)
-=
operation. Read moresourceimpl<T: Distribution> SupModel<Matrix<f64>, Matrix<f64>> for NaiveBayes<T>
impl<T: Distribution> SupModel<Matrix<f64>, Matrix<f64>> for NaiveBayes<T>
Train and predict from the Naive Bayes model.
The input matrix must be rows made up of features. The target matrix should have indicator vectors in each row specifying the input class. e.g. [[1,0,0],[0,0,1]] shows class 1 first, then class 3.
sourcefn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Matrix<f64>
) -> LearningResult<()>
fn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Matrix<f64>
) -> LearningResult<()>
Train the model using inputs and targets.
sourcefn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Matrix<f64>>
fn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Matrix<f64>>
Predict output from inputs.
sourceimpl<T, A> SupModel<Matrix<f64>, Matrix<f64>> for NeuralNet<T, A>where
T: Criterion,
A: OptimAlgorithm<BaseNeuralNet<T>>,
impl<T, A> SupModel<Matrix<f64>, Matrix<f64>> for NeuralNet<T, A>where
T: Criterion,
A: OptimAlgorithm<BaseNeuralNet<T>>,
Supervised learning for the Neural Network.
The model is trained using back propagation.
sourcefn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Matrix<f64>>
fn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Matrix<f64>>
Predict neural network output using forward propagation.
sourcefn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Matrix<f64>
) -> LearningResult<()>
fn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Matrix<f64>
) -> LearningResult<()>
Train the model using gradient optimization and back propagation.
sourceimpl<T: Kernel, U: MeanFunc> SupModel<Matrix<f64>, Vector<f64>> for GaussianProcess<T, U>
impl<T: Kernel, U: MeanFunc> SupModel<Matrix<f64>, Vector<f64>> for GaussianProcess<T, U>
sourcefn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<f64>>
fn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<f64>>
Predict output from inputs.
sourcefn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<f64>
) -> LearningResult<()>
fn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<f64>
) -> LearningResult<()>
Train the model using data and outputs.
sourceimpl<C: Criterion> SupModel<Matrix<f64>, Vector<f64>> for GenLinearModel<C>
impl<C: Criterion> SupModel<Matrix<f64>, Vector<f64>> for GenLinearModel<C>
Supervised model trait for the GLM.
Predictions are made from the model by computing g^-1(Xb).
The model is trained using Iteratively Re-weighted Least Squares.
sourcefn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<f64>>
fn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<f64>>
Predict output from inputs.
sourcefn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<f64>
) -> LearningResult<()>
fn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<f64>
) -> LearningResult<()>
Train the model using inputs and targets.
sourceimpl SupModel<Matrix<f64>, Vector<f64>> for LinRegressor
impl SupModel<Matrix<f64>, Vector<f64>> for LinRegressor
sourcefn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<f64>
) -> LearningResult<()>
fn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<f64>
) -> LearningResult<()>
Train the linear regression model.
Takes training data and output values as input.
Examples
use rusty_machine::learning::lin_reg::LinRegressor;
use rusty_machine::linalg::Matrix;
use rusty_machine::linalg::Vector;
use rusty_machine::learning::SupModel;
let mut lin_mod = LinRegressor::default();
let inputs = Matrix::new(3,1, vec![2.0, 3.0, 4.0]);
let targets = Vector::new(vec![5.0, 6.0, 7.0]);
lin_mod.train(&inputs, &targets).unwrap();
sourcefn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<f64>>
fn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<f64>>
Predict output value from input data.
Model must be trained before prediction can be made.
sourceimpl<A> SupModel<Matrix<f64>, Vector<f64>> for LogisticRegressor<A>where
A: OptimAlgorithm<BaseLogisticRegressor>,
impl<A> SupModel<Matrix<f64>, Vector<f64>> for LogisticRegressor<A>where
A: OptimAlgorithm<BaseLogisticRegressor>,
sourcefn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<f64>
) -> LearningResult<()>
fn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<f64>
) -> LearningResult<()>
Train the logistic regression model.
Takes training data and output values as input.
Examples
use rusty_machine::learning::logistic_reg::LogisticRegressor;
use rusty_machine::linalg::Matrix;
use rusty_machine::linalg::Vector;
use rusty_machine::learning::SupModel;
let mut logistic_mod = LogisticRegressor::default();
let inputs = Matrix::new(3,2, vec![1.0, 2.0, 1.0, 3.0, 1.0, 4.0]);
let targets = Vector::new(vec![5.0, 6.0, 7.0]);
logistic_mod.train(&inputs, &targets).unwrap();
sourcefn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<f64>>
fn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<f64>>
Predict output value from input data.
Model must be trained before prediction can be made.
sourceimpl<K: Kernel> SupModel<Matrix<f64>, Vector<f64>> for SVM<K>
impl<K: Kernel> SupModel<Matrix<f64>, Vector<f64>> for SVM<K>
Train the model using the Pegasos algorithm and predict the model output from new data.
sourcefn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<f64>>
fn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<f64>>
sourcefn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<f64>
) -> LearningResult<()>
fn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<f64>
) -> LearningResult<()>
sourceimpl<S: KNearestSearch> SupModel<Matrix<f64>, Vector<usize>> for KNNClassifier<S>
impl<S: KNearestSearch> SupModel<Matrix<f64>, Vector<usize>> for KNNClassifier<S>
sourcefn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<usize>>
fn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<usize>>
sourcefn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<usize>
) -> LearningResult<()>
fn train(
&mut self,
inputs: &Matrix<f64>,
targets: &Vector<usize>
) -> LearningResult<()>
sourceimpl<T: Float> TransformFitter<Matrix<T>, MinMaxScaler<T>> for MinMaxFitter<T>
impl<T: Float> TransformFitter<Matrix<T>, MinMaxScaler<T>> for MinMaxFitter<T>
sourcefn fit(self, inputs: &Matrix<T>) -> LearningResult<MinMaxScaler<T>>
fn fit(self, inputs: &Matrix<T>) -> LearningResult<MinMaxScaler<T>>
Transformer
sourceimpl<T: Float + FromPrimitive> TransformFitter<Matrix<T>, Standardizer<T>> for StandardizerFitter<T>
impl<T: Float + FromPrimitive> TransformFitter<Matrix<T>, Standardizer<T>> for StandardizerFitter<T>
sourcefn fit(self, inputs: &Matrix<T>) -> LearningResult<Standardizer<T>>
fn fit(self, inputs: &Matrix<T>) -> LearningResult<Standardizer<T>>
Transformer
sourceimpl<T: Float> Transformer<Matrix<T>> for MinMaxScaler<T>
impl<T: Float> Transformer<Matrix<T>> for MinMaxScaler<T>
sourceimpl<T: Float, M> Transformer<Matrix<T>> for Normalizer<T, M>where
for<'a> M: MatrixNorm<T, MatrixSlice<'a, T>>,
impl<T: Float, M> Transformer<Matrix<T>> for Normalizer<T, M>where
for<'a> M: MatrixNorm<T, MatrixSlice<'a, T>>,
sourceimpl<R: Rng, T> Transformer<Matrix<T>> for Shuffler<R>
impl<R: Rng, T> Transformer<Matrix<T>> for Shuffler<R>
The Shuffler
will transform the input Matrix
by shuffling
its rows in place.
Under the hood this uses a Fisher-Yates shuffle.
sourcefn transform(&mut self, inputs: Matrix<T>) -> LearningResult<Matrix<T>>
fn transform(&mut self, inputs: Matrix<T>) -> LearningResult<Matrix<T>>
sourceimpl<T: Float + FromPrimitive> Transformer<Matrix<T>> for Standardizer<T>
impl<T: Float + FromPrimitive> Transformer<Matrix<T>> for Standardizer<T>
sourcefn transform(&mut self, inputs: Matrix<T>) -> LearningResult<Matrix<T>>
fn transform(&mut self, inputs: Matrix<T>) -> LearningResult<Matrix<T>>
sourceimpl UnSupModel<Matrix<f64>, Matrix<f64>> for GaussianMixtureModel
impl UnSupModel<Matrix<f64>, Matrix<f64>> for GaussianMixtureModel
sourcefn train(&mut self, inputs: &Matrix<f64>) -> LearningResult<()>
fn train(&mut self, inputs: &Matrix<f64>) -> LearningResult<()>
Train the model using inputs.
sourcefn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Matrix<f64>>
fn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Matrix<f64>>
Predict output from inputs.
sourceimpl UnSupModel<Matrix<f64>, Matrix<f64>> for PCA
impl UnSupModel<Matrix<f64>, Matrix<f64>> for PCA
Train the model and predict the model output from new data.
sourcefn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Matrix<f64>>
fn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Matrix<f64>>
sourcefn train(&mut self, inputs: &Matrix<f64>) -> LearningResult<()>
fn train(&mut self, inputs: &Matrix<f64>) -> LearningResult<()>
sourceimpl UnSupModel<Matrix<f64>, Vector<Option<usize>>> for DBSCAN
impl UnSupModel<Matrix<f64>, Vector<Option<usize>>> for DBSCAN
sourcefn train(&mut self, inputs: &Matrix<f64>) -> LearningResult<()>
fn train(&mut self, inputs: &Matrix<f64>) -> LearningResult<()>
Train the classifier using input data.
sourcefn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<Option<usize>>>
fn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<Option<usize>>>
sourceimpl<InitAlg: Initializer> UnSupModel<Matrix<f64>, Vector<usize>> for KMeansClassifier<InitAlg>
impl<InitAlg: Initializer> UnSupModel<Matrix<f64>, Vector<usize>> for KMeansClassifier<InitAlg>
sourcefn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<usize>>
fn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Vector<usize>>
Predict classes from data.
Model must be trained.
sourcefn train(&mut self, inputs: &Matrix<f64>) -> LearningResult<()>
fn train(&mut self, inputs: &Matrix<f64>) -> LearningResult<()>
Train the classifier using input data.