Struct opensrdk_linear_algebra::matrix::ge::Matrix
source · pub struct Matrix<T = f64>where
T: Number,{ /* private fields */ }
Expand description
Matrix
use opensrdk_linear_algebra::*;
let a = mat!(
1.0, 2.0;
3.0, 4.0
);
assert_eq!(a[0], [1.0, 3.0]);
assert_eq!(a[1], [2.0, 4.0]);
assert_eq!(a[(0, 0)], 1.0);
assert_eq!(a[(0, 1)], 2.0);
assert_eq!(a[(1, 0)], 3.0);
assert_eq!(a[(1, 1)], 4.0);
Implementations§
source§impl Matrix
impl Matrix
sourcepub fn potrf(self) -> Result<POTRF, MatrixError>
pub fn potrf(self) -> Result<POTRF, MatrixError>
Cholesky decomposition
for positive definite f64 matrix
https://en.wikipedia.org/wiki/Cholesky_decomposition
A = L * L^T
source§impl Matrix<c64>
impl Matrix<c64>
sourcepub fn potrf(self) -> Result<POTRF<c64>, MatrixError>
pub fn potrf(self) -> Result<POTRF<c64>, MatrixError>
Cholesky decomposition
for positive definite c64 matrix
https://en.wikipedia.org/wiki/Cholesky_decomposition
A = L * L^*
source§impl Matrix
impl Matrix
sourcepub fn sytrd(self) -> Result<SYTRD, MatrixError>
pub fn sytrd(self) -> Result<SYTRD, MatrixError>
Tridiagonalize
for symmetric matrix
source§impl<T> Matrix<T>where
T: Number,
impl<T> Matrix<T>where T: Number,
sourcepub fn trdet(&self) -> T
pub fn trdet(&self) -> T
Determinant
for triangle matrix To apply this method to none triangle matrix, use LU decomposition or Cholesky decomposition.
source§impl<T> Matrix<T>where
T: Number,
impl<T> Matrix<T>where T: Number,
sourcepub fn linear_prod(&self, rhs: &Matrix<T>) -> T
pub fn linear_prod(&self, rhs: &Matrix<T>) -> T
sourcepub fn hadamard_prod(self, rhs: &Matrix<T>) -> Matrix<T>
pub fn hadamard_prod(self, rhs: &Matrix<T>) -> Matrix<T>
source§impl Matrix
impl Matrix
sourcepub fn gesvd(self) -> Result<(Matrix, Matrix, Matrix), MatrixError>
pub fn gesvd(self) -> Result<(Matrix, Matrix, Matrix), MatrixError>
Singular Value Decomposition
https://en.wikipedia.org/wiki/Singular_value_decomposition
M = U * Sigma * V^T
(u, sigma, vt)
source§impl Matrix
impl Matrix
sourcepub fn getrf(self) -> Result<GETRF, MatrixError>
pub fn getrf(self) -> Result<GETRF, MatrixError>
LU decomposition
for f64
source§impl Matrix<c64>
impl Matrix<c64>
sourcepub fn getrf(self) -> Result<GETRF<c64>, MatrixError>
pub fn getrf(self) -> Result<GETRF<c64>, MatrixError>
LU decomposition
for c64
source§impl<T> Matrix<T>where
T: Number,
impl<T> Matrix<T>where T: Number,
pub fn new(rows: usize, cols: usize) -> Self
sourcepub fn from(rows: usize, elems: Vec<T>) -> Result<Self, MatrixError>
pub fn from(rows: usize, elems: Vec<T>) -> Result<Self, MatrixError>
You can do unwrap()
if you have a conviction that elems.len() % rows == 0