pub struct QRFactorization<S: Scalar + Entity> { /* private fields */ }Expand description
QR factorization of a matrix.
Caches the decomposition computed in new() and reuses it in every solve() /
solve_least_squares() call, avoiding redundant recomputation.
Implementations§
Source§impl<S: Scalar + SimpleEntity + Conjugate<Canonical = S> + ComplexField> QRFactorization<S>
impl<S: Scalar + SimpleEntity + Conjugate<Canonical = S> + ComplexField> QRFactorization<S>
Sourcepub fn new(matrix: &DenseMatrix<S>) -> Result<Self, LinalgError>
pub fn new(matrix: &DenseMatrix<S>) -> Result<Self, LinalgError>
Compute QR factorization of a matrix.
Requires m >= n (the matrix must have at least as many rows as columns).
The decomposition is cached and reused for subsequent solve() /
solve_least_squares() calls.
Sourcepub fn solve(&self, b: &[S]) -> Result<Vec<S>, LinalgError>
pub fn solve(&self, b: &[S]) -> Result<Vec<S>, LinalgError>
Solve Ax = b using the cached QR factorization (square systems only).
Sourcepub fn solve_least_squares(&self, b: &[S]) -> Result<Vec<S>, LinalgError>
pub fn solve_least_squares(&self, b: &[S]) -> Result<Vec<S>, LinalgError>
Solve the least-squares problem min ||Ax - b||_2.
Works for both square and overdetermined systems (m >= n). Uses the cached QR factorization.
Auto Trait Implementations§
impl<S> Freeze for QRFactorization<S>
impl<S> RefUnwindSafe for QRFactorization<S>where
<<S as Entity>::Group as ForCopyType>::FaerOfCopy<NonNull<<S as Entity>::Unit>>: RefUnwindSafe,
S: RefUnwindSafe,
impl<S> Send for QRFactorization<S>
impl<S> Sync for QRFactorization<S>
impl<S> Unpin for QRFactorization<S>where
<<S as Entity>::Group as ForCopyType>::FaerOfCopy<NonNull<<S as Entity>::Unit>>: Unpin,
S: Unpin,
impl<S> UnsafeUnpin for QRFactorization<S>
impl<S> UnwindSafe for QRFactorization<S>where
<<S as Entity>::Group as ForCopyType>::FaerOfCopy<NonNull<<S as Entity>::Unit>>: UnwindSafe,
S: UnwindSafe,
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> 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