easytensor-2.1.1.1: Pure, type-indexed haskell vector, matrix, and tensor library.
Safe HaskellNone
LanguageHaskell2010

Numeric.Subroutine.Householder

Synopsis

Documentation

householderReflectionInplaceR Source #

Arguments

:: forall (s :: Type) (t :: Type) (n :: Nat) (m :: Nat). (PrimBytes t, Ord t, Epsilon t, KnownDim n, KnownDim m) 
=> STDataFrame s t '[m]

Temporary buffer for a Householder axis vector

-> STDataFrame s t '[m, m]

Current state of \(P^\intercal\)

-> STDataFrame s t '[n, m]

Current state of \(R\)

-> Idxs '[n, m]

Pivot element

-> ST s Bool 

Run a Householder transformation inplace.

Similar to householderReflectionInplaceR, but works from right to left - use to zero elements to the right from the pivot.

Returns True if reflection has been performed, and False if it was not needed. This can be used to track the sign of det P.

householderReflectionInplaceL Source #

Arguments

:: forall (s :: Type) (t :: Type) (n :: Nat) (m :: Nat). (PrimBytes t, Ord t, Epsilon t, KnownDim n, KnownDim m) 
=> STDataFrame s t '[n]

Temporary buffer for a Householder axis vector

-> STDataFrame s t '[n, n]

Current state of \(P^\intercal\)

-> STDataFrame s t '[n, m]

Current state of \(R\)

-> Idxs '[n, m]

Pivot element

-> ST s Bool 

Run a Householder transformation inplace.

Given some orthongonal matrix \(P\), some matrix \(R\) and index \((k,l)\), reflects \(R\) along some hyperplane, such that all elements of \(R\) below index \( (k, l) \) become zeros, then updates \(P\) with the inverse of the same transform as \(R\).

Notes and invariants:

  1. The transformation happens inplace for both matrices \(P\) and \(R\); if \( R = P^\intercal A \), then \( R' = P^*PR = P'^\intercal A \), where \( P' \) and \( R' \) are the updated versions of the input matrices, \( P^* \) and \( A \) are implicit matrices.
  2. All elements below and to the left of index \(k,l\) in \(R\) are assumed (and not checked) to be zeros; these are not touched by the subroutine to save flops.
  3. A logical starting value for \(P\) is an identity matrix. The subroutine can be used for a QR decomposition: \( Q = P \).

Returns True if reflection has been performed, and False if it was not needed. This can be used to track the sign of det P.