pub struct Matrix { /* private fields */ }Implementations§
Source§impl Matrix
impl Matrix
pub fn new(rows: usize, cols: usize) -> Self
pub fn from_vec( data: Vec<f64>, rows: usize, cols: usize, ) -> Result<Self, String>
pub fn identity(size: usize) -> Self
pub fn rows(&self) -> usize
pub fn cols(&self) -> usize
pub fn transpose(&self) -> Matrix
pub fn lu_decomposition(&self) -> Result<(Matrix, Matrix, Vec<usize>), String>
pub fn lu_decomposition_with_tolerance( &self, singular_relative_epsilon: f64, ) -> Result<(Matrix, Matrix, Vec<usize>), String>
pub fn solve_lu(&self, b: &Matrix) -> Result<Matrix, String>
pub fn solve_lu_with_tolerance( &self, b: &Matrix, singular_relative_epsilon: f64, ) -> Result<Matrix, String>
Sourcepub fn solve_least_squares_qr(&self, b: &Matrix) -> Result<Matrix, String>
pub fn solve_least_squares_qr(&self, b: &Matrix) -> Result<Matrix, String>
Solve a (possibly non-square) least squares problem using Householder QR.
Solves min_x ||A x - b||_2, where A is self.
- If
rows >= cols, returns the standard least-squares solution. - If
rows < cols, returns the minimum-norm solution among all minimizers.
Sourcepub fn solve_least_squares_qr_with_info(
&self,
b: &Matrix,
) -> Result<(Matrix, LeastSquaresQrInfo), String>
pub fn solve_least_squares_qr_with_info( &self, b: &Matrix, ) -> Result<(Matrix, LeastSquaresQrInfo), String>
Solve a (possibly non-square) least squares problem using Householder QR, returning diagnostic information about rank and conditioning.
pub fn norm(&self) -> f64
pub fn try_add(&self, rhs: &Matrix) -> Result<Matrix, MatrixError>
pub fn try_sub(&self, rhs: &Matrix) -> Result<Matrix, MatrixError>
pub fn try_mul(&self, rhs: &Matrix) -> Result<Matrix, MatrixError>
Trait Implementations§
impl StructuralPartialEq for Matrix
Auto Trait Implementations§
impl Freeze for Matrix
impl RefUnwindSafe for Matrix
impl Send for Matrix
impl Sync for Matrix
impl Unpin for Matrix
impl UnwindSafe for Matrix
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more