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 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 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 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
pub fn is_same_size(&self, other: &Matrix<T>) -> bool
pub fn rows(&self) -> usize
pub fn cols(&self) -> usize
pub fn vec(self) -> Vec<T>
pub fn elems(&self) -> &[T] ⓘ
pub fn elems_mut(&mut self) -> &mut [T] ⓘ
pub fn reshape(self, rows: usize) -> Self
pub fn eject_row(&self, index: usize) -> Vec<T>
pub fn eject_sub_matrix( &self, start_i: usize, start_j: usize, rows: usize, cols: usize ) -> Matrix<T>
Trait Implementations§
source§impl<T> AddAssign<Matrix<T>> for Matrix<T>where
T: Number,
impl<T> AddAssign<Matrix<T>> for Matrix<T>where T: Number,
source§fn add_assign(&mut self, rhs: Matrix<T>)
fn add_assign(&mut self, rhs: Matrix<T>)
Performs the
+=
operation. Read moresource§impl<'de, T> Deserialize<'de> for Matrix<T>where
T: Number + Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Matrix<T>where T: Number + Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T> DivAssign<Matrix<T>> for Matrix<T>where
T: Number,
impl<T> DivAssign<Matrix<T>> for Matrix<T>where T: Number,
source§fn div_assign(&mut self, rhs: Matrix<T>)
fn div_assign(&mut self, rhs: Matrix<T>)
Performs the
/=
operation. Read moresource§impl<T> MulAssign<Matrix<T>> for Matrix<T>where
T: Number,
impl<T> MulAssign<Matrix<T>> for Matrix<T>where T: Number,
source§fn mul_assign(&mut self, rhs: Matrix<T>)
fn mul_assign(&mut self, rhs: Matrix<T>)
Performs the
*=
operation. Read moresource§impl<T> PartialEq<Matrix<T>> for Matrix<T>where
T: Number + PartialEq,
impl<T> PartialEq<Matrix<T>> for Matrix<T>where T: Number + PartialEq,
source§impl<T> SubAssign<Matrix<T>> for Matrix<T>where
T: Number,
impl<T> SubAssign<Matrix<T>> for Matrix<T>where T: Number,
source§fn sub_assign(&mut self, rhs: Matrix<T>)
fn sub_assign(&mut self, rhs: Matrix<T>)
Performs the
-=
operation. Read more