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 transpose_with_parallel(&self, parallel: bool) -> 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.
pub fn solve_least_squares_qr_with_parallel( &self, b: &Matrix, parallel: bool, ) -> Result<Matrix, String>
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 solve_least_squares_qr_with_info_with_parallel( &self, b: &Matrix, parallel: bool, ) -> Result<(Matrix, LeastSquaresQrInfo), String>
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>
pub fn try_mul_with_parallel( &self, rhs: &Matrix, parallel: bool, ) -> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more