Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class RealFloatExtras t => MatrixSVD (t :: Type) (n :: Nat) (m :: Nat) where
- svd :: IterativeMethod => Matrix t n m -> SVD t n m
- data SVD (t :: Type) (n :: Nat) (m :: Nat) = SVD {}
- svd1 :: (PrimBytes t, Num t, Eq t) => Matrix t 1 1 -> SVD t 1 1
- svd2 :: forall t. RealFloatExtras t => Matrix t 2 2 -> SVD t 2 2
- svd3 :: forall t. (Quaternion t, RealFloatExtras t) => Matrix t 3 3 -> SVD t 3 3
- svd3q :: forall t. (Quaternion t, RealFloatExtras t) => Matrix t 3 3 -> (Quater t, Vector t 3, Quater t)
Documentation
class RealFloatExtras t => MatrixSVD (t :: Type) (n :: Nat) (m :: Nat) where Source #
Instances
(RealFloatExtras t, KnownDim n, KnownDim m) => MatrixSVD t n m Source # | |
(RealFloatExtras t, Quaternion t) => MatrixSVD t 3 3 Source # | |
RealFloatExtras t => MatrixSVD t 2 2 Source # | |
RealFloatExtras t => MatrixSVD t 1 1 Source # | |
data SVD (t :: Type) (n :: Nat) (m :: Nat) Source #
Result of SVD factorization
M = svdU %* asDiag svdS %* transpose svdV
.
Invariants:
- Singular values
svdS
are in non-increasing order and are non-negative. - svdU and svdV are orthogonal matrices
- det svdU == 1
NB: SVD on wiki
svd1 :: (PrimBytes t, Num t, Eq t) => Matrix t 1 1 -> SVD t 1 1 Source #
Obvious dummy implementation of SVD for 1x1 matrices
svd2 :: forall t. RealFloatExtras t => Matrix t 2 2 -> SVD t 2 2 Source #
SVD of a 2x2 matrix can be computed analytically
Related discussion:
https://scicomp.stackexchange.com/questions/8899/robust-algorithm-for-2-times-2-svd/
svd3 :: forall t. (Quaternion t, RealFloatExtras t) => Matrix t 3 3 -> SVD t 3 3 Source #
svd3q :: forall t. (Quaternion t, RealFloatExtras t) => Matrix t 3 3 -> (Quater t, Vector t 3, Quater t) Source #
Get SVD decomposition of a 3x3 matrix, with orthogonal matrices U and V represented as quaternions. Important: U and V are bound to be rotations at the expense of the last singular value being possibly negative.
This is an adoptation of a specialized 3x3 SVD algorithm described in "Computing the Singular Value Decomposition of 3x3 matrices with minimal branching and elementary floating point operations", by A. McAdams, A. Selle, R. Tamstorf, J. Teran, E. Sifakis.