Safe Haskell | None |
---|
- type Triangular lo diag up sh = ArrayMatrix (Triangular lo diag up sh)
- type UpLo lo up = (UpLoC lo up, UpLoC up lo)
- type Diagonal sh = FlexDiagonal NonUnit sh
- type FlexDiagonal diag sh = ArrayMatrix (Triangular Empty diag Empty sh)
- type Upper sh = FlexUpper NonUnit sh
- type FlexUpper diag sh = ArrayMatrix (UpperTriangular diag sh)
- type UnitUpper sh = FlexUpper Unit sh
- type Lower sh = FlexLower NonUnit sh
- type FlexLower diag sh = ArrayMatrix (LowerTriangular diag sh)
- type UnitLower sh = FlexLower Unit sh
- type Symmetric sh = FlexSymmetric NonUnit sh
- type FlexSymmetric diag sh = ArrayMatrix (FlexSymmetric diag sh)
- size :: Triangular lo diag up sh a -> sh
- fromList :: (Content lo, Content up, C sh, Storable a) => Order -> sh -> [a] -> Triangular lo NonUnit up sh a
- autoFromList :: (Content lo, Content up, Storable a) => Order -> [a] -> Triangular lo NonUnit up ShapeInt a
- diagonalFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Diagonal sh a
- autoDiagonalFromList :: Storable a => Order -> [a] -> Diagonal ShapeInt a
- lowerFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Lower sh a
- autoLowerFromList :: Storable a => Order -> [a] -> Lower ShapeInt a
- upperFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Upper sh a
- autoUpperFromList :: Storable a => Order -> [a] -> Upper ShapeInt a
- symmetricFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Symmetric sh a
- autoSymmetricFromList :: Storable a => Order -> [a] -> Symmetric ShapeInt a
- asDiagonal :: FlexDiagonal diag sh a -> FlexDiagonal diag sh a
- asLower :: FlexLower diag sh a -> FlexLower diag sh a
- asUpper :: FlexUpper diag sh a -> FlexUpper diag sh a
- asSymmetric :: FlexSymmetric diag sh a -> FlexSymmetric diag sh a
- requireUnitDiagonal :: Triangular lo Unit up sh a -> Triangular lo Unit up sh a
- requireNonUnitDiagonal :: Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a
- relaxUnitDiagonal :: TriDiag diag => Triangular lo Unit up sh a -> Triangular lo diag up sh a
- strictNonUnitDiagonal :: TriDiag diag => Triangular lo diag up sh a -> Triangular lo NonUnit up sh a
- identity :: (Content lo, Content up, C sh, Floating a) => Order -> sh -> Triangular lo Unit up sh a
- diagonal :: (Content lo, Content up, C sh, Floating a) => Order -> Vector sh a -> Triangular lo NonUnit up sh a
- takeDiagonal :: (Content lo, Content up, C sh, Floating a) => Triangular lo diag up sh a -> Vector sh a
- transpose :: (Content lo, Content up, TriDiag diag) => Triangular lo diag up sh a -> Triangular up diag lo sh a
- adjoint :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> Triangular up diag lo sh a
- stackDiagonal :: (TriDiag diag, C sh0, C sh1, Floating a) => FlexDiagonal diag sh0 a -> FlexDiagonal diag sh1 a -> FlexDiagonal diag (sh0 :+: sh1) a
- (%%%) :: (TriDiag diag, C sh0, C sh1, Floating a) => FlexDiagonal diag sh0 a -> FlexDiagonal diag sh1 a -> FlexDiagonal diag (sh0 :+: sh1) a
- stackLower :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexLower diag sh0 a -> General sh1 sh0 a -> FlexLower diag sh1 a -> FlexLower diag (sh0 :+: sh1) a
- (#%%%) :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexLower diag sh0 a -> (General sh1 sh0 a, FlexLower diag sh1 a) -> FlexLower diag (sh0 :+: sh1) a
- stackUpper :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexUpper diag sh0 a -> General sh0 sh1 a -> FlexUpper diag sh1 a -> FlexUpper diag (sh0 :+: sh1) a
- (%%%#) :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => (FlexUpper diag sh0 a, General sh0 sh1 a) -> FlexUpper diag sh1 a -> FlexUpper diag (sh0 :+: sh1) a
- stackSymmetric :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexSymmetric diag sh0 a -> General sh0 sh1 a -> FlexSymmetric diag sh1 a -> FlexSymmetric diag (sh0 :+: sh1) a
- (#%%%#) :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => (FlexSymmetric diag sh0 a, General sh0 sh1 a) -> FlexSymmetric diag sh1 a -> FlexSymmetric diag (sh0 :+: sh1) a
- splitDiagonal :: (TriDiag diag, C sh0, C sh1, Floating a) => FlexDiagonal diag (sh0 :+: sh1) a -> (FlexDiagonal diag sh0 a, FlexDiagonal diag sh1 a)
- splitLower :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexLower diag (sh0 :+: sh1) a -> (FlexLower diag sh0 a, General sh1 sh0 a, FlexLower diag sh1 a)
- splitUpper :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexUpper diag (sh0 :+: sh1) a -> (FlexUpper diag sh0 a, General sh0 sh1 a, FlexUpper diag sh1 a)
- splitSymmetric :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexSymmetric diag (sh0 :+: sh1) a -> (FlexSymmetric diag sh0 a, General sh0 sh1 a, FlexSymmetric diag sh1 a)
- takeTopLeft :: (Content lo, TriDiag diag, Content up, C sh0, C sh1, Floating a) => Triangular lo diag up (sh0 :+: sh1) a -> Triangular lo diag up sh0 a
- takeTopRight :: (Content lo, TriDiag diag, C sh0, C sh1, Floating a) => Triangular lo diag Filled (sh0 :+: sh1) a -> General sh0 sh1 a
- takeBottomLeft :: (TriDiag diag, Content up, C sh0, C sh1, Floating a) => Triangular Filled diag up (sh0 :+: sh1) a -> General sh1 sh0 a
- takeBottomRight :: (Content lo, TriDiag diag, Content up, C sh0, C sh1, Floating a) => Triangular lo diag up (sh0 :+: sh1) a -> Triangular lo diag up sh1 a
- toSquare :: (Content lo, Content up, C sh, Floating a) => Triangular lo diag up sh a -> Square sh a
- takeLower :: (C horiz, C height, C width, Floating a) => Full Small horiz height width a -> Lower height a
- takeUpper :: (C vert, C height, C width, Floating a) => Full vert Small height width a -> Upper width a
- fromLowerRowMajor :: (C sh, Floating a) => Array (Triangular Lower sh) a -> Lower sh a
- toLowerRowMajor :: (C sh, Floating a) => Lower sh a -> Array (Triangular Lower sh) a
- fromUpperRowMajor :: (C sh, Floating a) => Array (Triangular Upper sh) a -> Upper sh a
- toUpperRowMajor :: (C sh, Floating a) => Upper sh a -> Array (Triangular Upper sh) a
- forceOrder :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Order -> Triangular lo diag up sh a -> Triangular lo diag up sh a
- adaptOrder :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> Triangular lo diag up sh a -> Triangular lo diag up sh a
- add :: (Content lo, Content up, Eq lo, Eq up, Eq sh, C sh, Floating a) => Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a
- sub :: (Content lo, Content up, Eq lo, Eq up, Eq sh, C sh, Floating a) => Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a
- type family PowerDiag lo up diag
- type PowerContentDiag lo diag up = (Content lo, Content up, TriDiag diag, PowerDiag lo up diag ~ diag, PowerDiag up lo diag ~ diag)
- multiplyVector :: (Content lo, Content up, TriDiag diag, C sh, Eq sh, Floating a) => Triangular lo diag up sh a -> Vector sh a -> Vector sh a
- square :: (Content lo, Content up, TriDiag diag, C sh, Eq sh, Floating a) => Triangular lo diag up sh a -> Triangular lo (PowerDiag lo up diag) up sh a
- multiply :: (DiagUpLo lo up, TriDiag diag, C sh, Eq sh, Floating a) => Triangular lo diag up sh a -> Triangular lo diag up sh a -> Triangular lo diag up sh a
- multiplyFull :: (Content lo, Content up, TriDiag diag, C vert, C horiz, C height, Eq height, C width, Floating a) => Triangular lo diag up height a -> Full vert horiz height width a -> Full vert horiz height width a
- solve :: (Content lo, Content up, TriDiag diag, C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Triangular lo diag up sh a -> Full vert horiz sh nrhs a -> Full vert horiz sh nrhs a
- inverse :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> Triangular lo (PowerDiag lo up diag) up sh a
- determinant :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> a
- eigenvalues :: (DiagUpLo lo up, C sh, Floating a) => Triangular lo diag up sh a -> Vector sh a
- eigensystem :: (DiagUpLo lo up, C sh, Floating a) => Triangular lo NonUnit up sh a -> (Triangular lo NonUnit up sh a, Vector sh a, Triangular lo NonUnit up sh a)
Documentation
type Triangular lo diag up sh = ArrayMatrix (Triangular lo diag up sh)Source
type Diagonal sh = FlexDiagonal NonUnit shSource
type FlexDiagonal diag sh = ArrayMatrix (Triangular Empty diag Empty sh)Source
type FlexUpper diag sh = ArrayMatrix (UpperTriangular diag sh)Source
type FlexLower diag sh = ArrayMatrix (LowerTriangular diag sh)Source
type Symmetric sh = FlexSymmetric NonUnit shSource
type FlexSymmetric diag sh = ArrayMatrix (FlexSymmetric diag sh)Source
size :: Triangular lo diag up sh a -> shSource
fromList :: (Content lo, Content up, C sh, Storable a) => Order -> sh -> [a] -> Triangular lo NonUnit up sh aSource
autoFromList :: (Content lo, Content up, Storable a) => Order -> [a] -> Triangular lo NonUnit up ShapeInt aSource
asDiagonal :: FlexDiagonal diag sh a -> FlexDiagonal diag sh aSource
asSymmetric :: FlexSymmetric diag sh a -> FlexSymmetric diag sh aSource
requireUnitDiagonal :: Triangular lo Unit up sh a -> Triangular lo Unit up sh aSource
requireNonUnitDiagonal :: Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh aSource
relaxUnitDiagonal :: TriDiag diag => Triangular lo Unit up sh a -> Triangular lo diag up sh aSource
strictNonUnitDiagonal :: TriDiag diag => Triangular lo diag up sh a -> Triangular lo NonUnit up sh aSource
identity :: (Content lo, Content up, C sh, Floating a) => Order -> sh -> Triangular lo Unit up sh aSource
diagonal :: (Content lo, Content up, C sh, Floating a) => Order -> Vector sh a -> Triangular lo NonUnit up sh aSource
takeDiagonal :: (Content lo, Content up, C sh, Floating a) => Triangular lo diag up sh a -> Vector sh aSource
transpose :: (Content lo, Content up, TriDiag diag) => Triangular lo diag up sh a -> Triangular up diag lo sh aSource
adjoint :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> Triangular up diag lo sh aSource
stackDiagonal :: (TriDiag diag, C sh0, C sh1, Floating a) => FlexDiagonal diag sh0 a -> FlexDiagonal diag sh1 a -> FlexDiagonal diag (sh0 :+: sh1) aSource
(%%%) :: (TriDiag diag, C sh0, C sh1, Floating a) => FlexDiagonal diag sh0 a -> FlexDiagonal diag sh1 a -> FlexDiagonal diag (sh0 :+: sh1) aSource
stackLower :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexLower diag sh0 a -> General sh1 sh0 a -> FlexLower diag sh1 a -> FlexLower diag (sh0 :+: sh1) aSource
(#%%%) :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexLower diag sh0 a -> (General sh1 sh0 a, FlexLower diag sh1 a) -> FlexLower diag (sh0 :+: sh1) aSource
stackUpper :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexUpper diag sh0 a -> General sh0 sh1 a -> FlexUpper diag sh1 a -> FlexUpper diag (sh0 :+: sh1) aSource
(%%%#) :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => (FlexUpper diag sh0 a, General sh0 sh1 a) -> FlexUpper diag sh1 a -> FlexUpper diag (sh0 :+: sh1) aSource
stackSymmetric :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexSymmetric diag sh0 a -> General sh0 sh1 a -> FlexSymmetric diag sh1 a -> FlexSymmetric diag (sh0 :+: sh1) aSource
(#%%%#) :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => (FlexSymmetric diag sh0 a, General sh0 sh1 a) -> FlexSymmetric diag sh1 a -> FlexSymmetric diag (sh0 :+: sh1) aSource
splitDiagonal :: (TriDiag diag, C sh0, C sh1, Floating a) => FlexDiagonal diag (sh0 :+: sh1) a -> (FlexDiagonal diag sh0 a, FlexDiagonal diag sh1 a)Source
splitLower :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexLower diag (sh0 :+: sh1) a -> (FlexLower diag sh0 a, General sh1 sh0 a, FlexLower diag sh1 a)Source
splitUpper :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexUpper diag (sh0 :+: sh1) a -> (FlexUpper diag sh0 a, General sh0 sh1 a, FlexUpper diag sh1 a)Source
splitSymmetric :: (TriDiag diag, C sh0, Eq sh0, C sh1, Eq sh1, Floating a) => FlexSymmetric diag (sh0 :+: sh1) a -> (FlexSymmetric diag sh0 a, General sh0 sh1 a, FlexSymmetric diag sh1 a)Source
takeTopLeft :: (Content lo, TriDiag diag, Content up, C sh0, C sh1, Floating a) => Triangular lo diag up (sh0 :+: sh1) a -> Triangular lo diag up sh0 aSource
takeTopRight :: (Content lo, TriDiag diag, C sh0, C sh1, Floating a) => Triangular lo diag Filled (sh0 :+: sh1) a -> General sh0 sh1 aSource
takeBottomLeft :: (TriDiag diag, Content up, C sh0, C sh1, Floating a) => Triangular Filled diag up (sh0 :+: sh1) a -> General sh1 sh0 aSource
takeBottomRight :: (Content lo, TriDiag diag, Content up, C sh0, C sh1, Floating a) => Triangular lo diag up (sh0 :+: sh1) a -> Triangular lo diag up sh1 aSource
toSquare :: (Content lo, Content up, C sh, Floating a) => Triangular lo diag up sh a -> Square sh aSource
takeLower :: (C horiz, C height, C width, Floating a) => Full Small horiz height width a -> Lower height aSource
takeUpper :: (C vert, C height, C width, Floating a) => Full vert Small height width a -> Upper width aSource
fromLowerRowMajor :: (C sh, Floating a) => Array (Triangular Lower sh) a -> Lower sh aSource
toLowerRowMajor :: (C sh, Floating a) => Lower sh a -> Array (Triangular Lower sh) aSource
fromUpperRowMajor :: (C sh, Floating a) => Array (Triangular Upper sh) a -> Upper sh aSource
toUpperRowMajor :: (C sh, Floating a) => Upper sh a -> Array (Triangular Upper sh) aSource
forceOrder :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Order -> Triangular lo diag up sh a -> Triangular lo diag up sh aSource
adaptOrder :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> Triangular lo diag up sh a -> Triangular lo diag up sh aSource
adaptOrder x y
contains the data of y
with the layout of x
.
add :: (Content lo, Content up, Eq lo, Eq up, Eq sh, C sh, Floating a) => Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh aSource
sub :: (Content lo, Content up, Eq lo, Eq up, Eq sh, C sh, Floating a) => Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh a -> Triangular lo NonUnit up sh aSource
type PowerContentDiag lo diag up = (Content lo, Content up, TriDiag diag, PowerDiag lo up diag ~ diag, PowerDiag up lo diag ~ diag)Source
multiplyVector :: (Content lo, Content up, TriDiag diag, C sh, Eq sh, Floating a) => Triangular lo diag up sh a -> Vector sh a -> Vector sh aSource
square :: (Content lo, Content up, TriDiag diag, C sh, Eq sh, Floating a) => Triangular lo diag up sh a -> Triangular lo (PowerDiag lo up diag) up sh aSource
Include symmetric matrices. However, symmetric matrices do not preserve unit diagonals.
multiply :: (DiagUpLo lo up, TriDiag diag, C sh, Eq sh, Floating a) => Triangular lo diag up sh a -> Triangular lo diag up sh a -> Triangular lo diag up sh aSource
multiplyFull :: (Content lo, Content up, TriDiag diag, C vert, C horiz, C height, Eq height, C width, Floating a) => Triangular lo diag up height a -> Full vert horiz height width a -> Full vert horiz height width aSource
solve :: (Content lo, Content up, TriDiag diag, C vert, C horiz, C sh, Eq sh, C nrhs, Floating a) => Triangular lo diag up sh a -> Full vert horiz sh nrhs a -> Full vert horiz sh nrhs aSource
inverse :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> Triangular lo (PowerDiag lo up diag) up sh aSource
determinant :: (Content lo, Content up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> aSource
eigenvalues :: (DiagUpLo lo up, C sh, Floating a) => Triangular lo diag up sh a -> Vector sh aSource
eigensystem :: (DiagUpLo lo up, C sh, Floating a) => Triangular lo NonUnit up sh a -> (Triangular lo NonUnit up sh a, Vector sh a, Triangular lo NonUnit up sh a)Source
(vr,d,vlAdj) = eigensystem a
Counterintuitively, vr
contains the right eigenvectors as columns
and vlAdj
contains the left conjugated eigenvectors as rows.
The idea is to provide a decomposition of a
.
If a
is diagonalizable, then vr
and vlAdj
are almost inverse to each other.
More precisely, vlAdj <> vr
is a diagonal matrix,
but not necessarily an identity matrix.
This is because all eigenvectors are normalized
such that normInf1
is 1.
With the following scaling, the decomposition becomes perfect:
let scal = takeDiagonal $ vlAdj <> vr a == vr <> diagonal (Vector.divide d scal) <> vlAdj
If a
is non-diagonalizable
then some columns of vr
and corresponding rows of vlAdj
are left zero
and the above property does not hold.