pub struct QR<N, R, C>where
N: Real,
R: DimMin<C>,
C: Dim,
DefaultAllocator: Allocator<N, R, C> + Allocator<N, <R as DimMin<C>>::Output, U1>,{ /* private fields */ }
Expand description
The QR decomposition of a general matrix.
Implementations§
source§impl<N, R, C> QR<N, R, C>where
N: Real,
R: DimMin<C>,
C: Dim,
DefaultAllocator: Allocator<N, R, C> + Allocator<N, R, U1> + Allocator<N, <R as DimMin<C>>::Output, U1>,
impl<N, R, C> QR<N, R, C>where
N: Real,
R: DimMin<C>,
C: Dim,
DefaultAllocator: Allocator<N, R, C> + Allocator<N, R, U1> + Allocator<N, <R as DimMin<C>>::Output, U1>,
sourcepub fn new(
matrix: Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>
) -> QR<N, R, C>
pub fn new(
matrix: Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>
) -> QR<N, R, C>
Computes the QR decomposition using householder reflections.
sourcepub fn r(
&self
) -> Matrix<N, <R as DimMin<C>>::Output, C, <DefaultAllocator as Allocator<N, <R as DimMin<C>>::Output, C>>::Buffer>where
DefaultAllocator: Allocator<N, <R as DimMin<C>>::Output, C>,
<R as DimMin<C>>::Output: DimMin<C, Output = <R as DimMin<C>>::Output>,
pub fn r(
&self
) -> Matrix<N, <R as DimMin<C>>::Output, C, <DefaultAllocator as Allocator<N, <R as DimMin<C>>::Output, C>>::Buffer>where
DefaultAllocator: Allocator<N, <R as DimMin<C>>::Output, C>,
<R as DimMin<C>>::Output: DimMin<C, Output = <R as DimMin<C>>::Output>,
Retrieves the upper trapezoidal submatrix R
of this decomposition.
sourcepub fn unpack_r(
self
) -> Matrix<N, <R as DimMin<C>>::Output, C, <DefaultAllocator as Allocator<N, <R as DimMin<C>>::Output, C>>::Buffer>where
DefaultAllocator: Reallocator<N, R, C, <R as DimMin<C>>::Output, C>,
<R as DimMin<C>>::Output: DimMin<C, Output = <R as DimMin<C>>::Output>,
pub fn unpack_r(
self
) -> Matrix<N, <R as DimMin<C>>::Output, C, <DefaultAllocator as Allocator<N, <R as DimMin<C>>::Output, C>>::Buffer>where
DefaultAllocator: Reallocator<N, R, C, <R as DimMin<C>>::Output, C>,
<R as DimMin<C>>::Output: DimMin<C, Output = <R as DimMin<C>>::Output>,
Retrieves the upper trapezoidal submatrix R
of this decomposition.
This is usually faster than r
but consumes self
.
sourcepub fn q(
&self
) -> Matrix<N, R, <R as DimMin<C>>::Output, <DefaultAllocator as Allocator<N, R, <R as DimMin<C>>::Output>>::Buffer>where
DefaultAllocator: Allocator<N, R, <R as DimMin<C>>::Output>,
pub fn q(
&self
) -> Matrix<N, R, <R as DimMin<C>>::Output, <DefaultAllocator as Allocator<N, R, <R as DimMin<C>>::Output>>::Buffer>where
DefaultAllocator: Allocator<N, R, <R as DimMin<C>>::Output>,
Computes the orthogonal matrix Q
of this decomposition.
sourcepub fn unpack(
self
) -> (Matrix<N, R, <R as DimMin<C>>::Output, <DefaultAllocator as Allocator<N, R, <R as DimMin<C>>::Output>>::Buffer>, Matrix<N, <R as DimMin<C>>::Output, C, <DefaultAllocator as Allocator<N, <R as DimMin<C>>::Output, C>>::Buffer>)where
<R as DimMin<C>>::Output: DimMin<C, Output = <R as DimMin<C>>::Output>,
DefaultAllocator: Allocator<N, R, <R as DimMin<C>>::Output> + Reallocator<N, R, C, <R as DimMin<C>>::Output, C>,
pub fn unpack(
self
) -> (Matrix<N, R, <R as DimMin<C>>::Output, <DefaultAllocator as Allocator<N, R, <R as DimMin<C>>::Output>>::Buffer>, Matrix<N, <R as DimMin<C>>::Output, C, <DefaultAllocator as Allocator<N, <R as DimMin<C>>::Output, C>>::Buffer>)where
<R as DimMin<C>>::Output: DimMin<C, Output = <R as DimMin<C>>::Output>,
DefaultAllocator: Allocator<N, R, <R as DimMin<C>>::Output> + Reallocator<N, R, C, <R as DimMin<C>>::Output, C>,
Unpacks this decomposition into its two matrix factors.
source§impl<N, D> QR<N, D, D>where
N: Real,
D: DimMin<D, Output = D>,
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D, U1>,
impl<N, D> QR<N, D, D>where
N: Real,
D: DimMin<D, Output = D>,
DefaultAllocator: Allocator<N, D, D> + Allocator<N, D, U1>,
sourcepub fn solve<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>
) -> Option<Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>>where
R2: Dim,
C2: Dim,
S2: StorageMut<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
DefaultAllocator: Allocator<N, R2, C2>,
pub fn solve<R2, C2, S2>(
&self,
b: &Matrix<N, R2, C2, S2>
) -> Option<Matrix<N, R2, C2, <DefaultAllocator as Allocator<N, R2, C2>>::Buffer>>where
R2: Dim,
C2: Dim,
S2: StorageMut<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
DefaultAllocator: Allocator<N, R2, C2>,
Solves the linear system self * x = b
, where x
is the unknown to be determined.
Returns None
if self
is not invertible.
sourcepub fn solve_mut<R2, C2, S2>(&self, b: &mut Matrix<N, R2, C2, S2>) -> boolwhere
R2: Dim,
C2: Dim,
S2: StorageMut<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
pub fn solve_mut<R2, C2, S2>(&self, b: &mut Matrix<N, R2, C2, S2>) -> boolwhere
R2: Dim,
C2: Dim,
S2: StorageMut<N, R2, C2>,
ShapeConstraint: SameNumberOfRows<R2, D>,
Solves the linear system self * x = b
, where x
is the unknown to be determined.
If the decomposed matrix is not invertible, this returns false
and its input b
is
overwritten with garbage.
sourcepub fn try_inverse(
&self
) -> Option<Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>>
pub fn try_inverse(
&self
) -> Option<Matrix<N, D, D, <DefaultAllocator as Allocator<N, D, D>>::Buffer>>
Computes the inverse of the decomposed matrix.
Returns None
if the decomposed matrix is not invertible.
sourcepub fn is_invertible(&self) -> bool
pub fn is_invertible(&self) -> bool
Indicates if the decomposed matrix is invertible.
Trait Implementations§
source§impl<N, R, C> Clone for QR<N, R, C>where
N: Clone + Real,
R: Clone + DimMin<C>,
C: Clone + Dim,
DefaultAllocator: Allocator<N, R, C> + Allocator<N, <R as DimMin<C>>::Output, U1>,
impl<N, R, C> Clone for QR<N, R, C>where
N: Clone + Real,
R: Clone + DimMin<C>,
C: Clone + Dim,
DefaultAllocator: Allocator<N, R, C> + Allocator<N, <R as DimMin<C>>::Output, U1>,
source§impl<N, R, C> Debug for QR<N, R, C>where
N: Debug + Real,
R: Debug + DimMin<C>,
C: Debug + Dim,
DefaultAllocator: Allocator<N, R, C> + Allocator<N, <R as DimMin<C>>::Output, U1>,
impl<N, R, C> Debug for QR<N, R, C>where
N: Debug + Real,
R: Debug + DimMin<C>,
C: Debug + Dim,
DefaultAllocator: Allocator<N, R, C> + Allocator<N, <R as DimMin<C>>::Output, U1>,
impl<N, R, C> Copy for QR<N, R, C>where
N: Real,
R: DimMin<C>,
C: Dim,
DefaultAllocator: Allocator<N, R, C> + Allocator<N, <R as DimMin<C>>::Output, U1>,
Matrix<N, R, C, <DefaultAllocator as Allocator<N, R, C>>::Buffer>: Copy,
Matrix<N, <R as DimMin<C>>::Output, U1, <DefaultAllocator as Allocator<N, <R as DimMin<C>>::Output, U1>>::Buffer>: Copy,
Auto Trait Implementations§
impl<N, R, C> !RefUnwindSafe for QR<N, R, C>
impl<N, R, C> !Send for QR<N, R, C>
impl<N, R, C> !Sync for QR<N, R, C>
impl<N, R, C> !Unpin for QR<N, R, C>
impl<N, R, C> !UnwindSafe for QR<N, R, C>
Blanket Implementations§
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.