QR

Struct QR 

Source
pub struct QR<T, R, C>
where DefaultAllocator: Allocator<R, C> + Allocator<DimMinimum<R, C>>, T: Scalar, R: DimMin<C>, C: Dim,
{ /* private fields */ }
Expand description

The QR decomposition of a rectangular matrix A ∈ R^(m × n) with m >= n.

Implementations§

Source§

impl<T, R, C> QR<T, R, C>
where DefaultAllocator: Allocator<R, C> + Allocator<DimMinimum<R, C>>, T: Scalar, R: DimMin<C>, C: Dim,

Source

pub fn new(m: OMatrix<T, R, C>) -> Result<Self, Error>
where T: QrScalar + Zero,

Computes the QR decomposition of the matrix m.

Trait Implementations§

Source§

impl<T, R, C> Clone for QR<T, R, C>
where DefaultAllocator: Allocator<R, C> + Allocator<DimMinimum<R, C>>, T: Scalar + Clone, R: DimMin<C> + Clone, C: Dim + Clone,

Source§

fn clone(&self) -> QR<T, R, C>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, R, C> Debug for QR<T, R, C>
where DefaultAllocator: Allocator<R, C> + Allocator<DimMinimum<R, C>>, T: Scalar + Debug, R: DimMin<C> + Debug, C: Dim + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T, R, C> QrDecomposition<T, R, C> for QR<T, R, C>
where DefaultAllocator: Allocator<R, C> + Allocator<DimMinimum<R, C>> + Allocator<C>, R: DimMin<C, Output = C>, C: Dim, T: Scalar + RealField + QrReal,

Source§

fn solve_mut<C2: Dim, S, S2>( &self, x: &mut Matrix<T, C, C2, S2>, b: Matrix<T, R, C2, S>, ) -> Result<(), Error>
where S: RawStorageMut<T, R, C2> + IsContiguous, S2: RawStorageMut<T, C, C2> + IsContiguous, T: Zero,

Solve the square or overdetermined system in A X = B, where X ∈ R^(n × k), B ∈ R^(m × k) in a least-squares sense, such that || A X - B||^2 is minimized. The solution is placed into the matrix X ∈ R^(n × k). Read more
Source§

fn nrows(&self) -> usize

The number of rows of the original matrix A.
Source§

fn ncols(&self) -> usize

The number of columns of the original matrix A.
Source§

fn shape_generic(&self) -> (R, C)

Shape of the original matrix A.
Source§

fn solve<C2: Dim, S>( &self, rhs: Matrix<T, R, C2, S>, ) -> Result<OMatrix<T, C, C2>, Error>
where S: RawStorageMut<T, R, C2> + IsContiguous + Storage<T, R, C2>, T: Zero, DefaultAllocator: Allocator<C, C2> + Allocator<R, C2>,

Solve the overdetermined linear system with the given right hand side in a least squares sense, see the comments on Self::solve_mut.
Source§

fn q_mul_mut<C2, S>(&self, b: &mut Matrix<T, R, C2, S>) -> Result<(), Error>
where C2: Dim, S: RawStorageMut<T, R, C2> + IsContiguous,

Efficiently calculate the matrix product Q B of the factor Q with a given matrix B. Q acts as if it is a matrix of dimension m × m, so we require B ∈ R^(m × k). The product is calculated in place and must only be considered valid when the function returns without error.
Source§

fn q_tr_mul_mut<C2, S>(&self, b: &mut Matrix<T, R, C2, S>) -> Result<(), Error>
where C2: Dim, S: RawStorageMut<T, R, C2> + IsContiguous,

Efficiently calculate the matrix product Q^T B of the factor Q with a given matrix B. Q acts as if it is a matrix of dimension m × m, so we require B ∈ R^(m × k). The product is calculated in place and must only be considered valid when the function returns without error.
Source§

fn mul_q_mut<R2, S>(&self, b: &mut Matrix<T, R2, R, S>) -> Result<(), Error>
where R2: Dim, S: RawStorageMut<T, R2, R> + IsContiguous,

Efficiently calculate the matrix product B Q of the factor Q with a given matrix B. Q acts as if it is a matrix of dimension m × m, so we require B ∈ R^(k × m). The product is calculated in place and must only be considered valid when the function returns without error.
Source§

fn mul_q_tr_mut<R2, S>(&self, b: &mut Matrix<T, R2, R, S>) -> Result<(), Error>
where R2: Dim, S: RawStorageMut<T, R2, R> + IsContiguous,

Efficiently calculate the matrix product B Q^T of the factor Q with a given matrix B. Q acts as if it is a matrix of dimension m × m, so we require B ∈ R^(k × m). The product is calculated in place and must only be considered valid when the function returns without error.
Source§

fn r_mul_mut<C2, S2>(&self, b: &mut Matrix<T, C, C2, S2>) -> Result<(), Error>
where C2: Dim, S2: RawStorageMut<T, C, C2> + IsContiguous, T: ConstOne,

Multiply R*B and place the result in B. R is treated as an m × m upper triangular matrix. The product is calculated in place and must only be considered valid when the function returns without error. Read more
Source§

fn r_tr_mul_mut<C2, S2>( &self, b: &mut Matrix<T, C, C2, S2>, ) -> Result<(), Error>
where C2: Dim, S2: RawStorageMut<T, C, C2> + IsContiguous, T: ConstOne,

Multiply R^T * B and place the result in B. R is treated as an m × m upper triangular matrix. The product is calculated in place and must only be considered valid when the function returns without error. Read more
Source§

fn mul_r_mut<R2, S2>(&self, b: &mut Matrix<T, R2, C, S2>) -> Result<(), Error>
where R2: Dim, S2: RawStorageMut<T, R2, C> + IsContiguous, T: ConstOne,

Multiply B*R and place the result in B. R is treated as an m × m upper triangular matrix. The product is calculated in place and must only be considered valid when the function returns without error. Read more
Source§

fn mul_r_tr_mut<R2, S2>( &self, b: &mut Matrix<T, R2, C, S2>, ) -> Result<(), Error>
where R2: Dim, S2: RawStorageMut<T, R2, C> + IsContiguous, T: ConstOne,

Multiply B*R^T and place the result in B. R is treated as an m × m upper triangular matrix. The product is calculated in place and must only be considered valid when the function returns without error. Read more
Source§

fn q(&self) -> OMatrix<T, R, DimMinimum<R, C>>
where DefaultAllocator: Allocator<R, <R as DimMin<C>>::Output>, T: Zero,

Computes the orthonormal matrix Q ∈ R^(m × n) of this decomposition. Note that this matrix has economy dimensions, which means it is not square unless A is square. It satisfies Q^T Q = I. Note further that it is typically not necessary to compute Q explicitly. Rather, check if some of the provided multiplication functions can help to calculate the matrix products Q B, B Q, Q^T B, B Q^T more efficiently. Read more
Source§

fn r(&self) -> OMatrix<T, DimMinimum<R, C>, C>

Retrieves the upper trapezoidal submatrix R of this decomposition. Note that it’s typically not necessary to construct this matrix directly and check if any of the provided multiplication functions can be used instead. Read more
Source§

impl<T: Scalar + Copy, R: DimMin<C>, C: Dim> Copy for QR<T, R, C>
where DefaultAllocator: Allocator<R, C> + Allocator<DimMinimum<R, C>>, OMatrix<T, R, C>: Copy, OVector<T, DimMinimum<R, C>>: Copy,

Auto Trait Implementations§

§

impl<T, R, C> !Freeze for QR<T, R, C>

§

impl<T, R, C> !RefUnwindSafe for QR<T, R, C>

§

impl<T, R, C> !Send for QR<T, R, C>

§

impl<T, R, C> !Sync for QR<T, R, C>

§

impl<T, R, C> !Unpin for QR<T, R, C>

§

impl<T, R, C> !UnwindSafe for QR<T, R, C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.