lapack-0.2.4: Numerical Linear Algebra using LAPACK

Safe HaskellNone

Numeric.LAPACK.Matrix.Triangular

Synopsis

Documentation

type Triangular lo diag up sh = Array (Triangular lo diag up sh)Source

type UpLo lo up = (UpLoC lo up, UpLoC up lo)Source

type Diagonal sh = FlexDiagonal NonUnit shSource

type FlexUpper diag sh = Array (UpperTriangular diag sh)Source

type FlexLower diag sh = Array (LowerTriangular diag sh)Source

type FlexSymmetric diag sh = Array (FlexSymmetric diag sh)Source

fromList :: (Content lo, Content up, C sh, Storable a) => Order -> sh -> [a] -> Triangular lo NonUnit up sh aSource

lowerFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Lower sh aSource

upperFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Upper sh aSource

symmetricFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Symmetric sh aSource

diagonalFromList :: (C sh, Storable a) => Order -> sh -> [a] -> Diagonal 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

asDiagonal :: FlexDiagonal diag sh a -> FlexDiagonal diag sh aSource

asLower :: FlexLower diag sh a -> FlexLower diag sh aSource

asUpper :: FlexUpper diag sh a -> FlexUpper diag 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

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

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

For upper triangular matrices it holds:

 toSquare (stack a b c)

 =

 toSquare a ||| b
 ===
 constant 0 ||| toSquare c

For the other triangular flavors it holds accordingly

It holds order (stack a b c) = order b. The function is most efficient when the order of all blocks match.

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

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

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 family PowerDiag lo up 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 :: (DiagUpLo lo up, TriDiag diag, C sh, Eq sh, Floating a) => Triangular lo diag up sh a -> Triangular lo diag up sh aSource

squareGeneric :: (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 :: (DiagUpLo lo up, TriDiag diag, C sh, Floating a) => Triangular lo diag up sh a -> Triangular lo diag up sh aSource

inverseGeneric :: (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

size :: Triangular lo diag up sh a -> shSource

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. This is because the eigenvectors are not normalized. With the following scaling, the decomposition becomes perfect:

 let scal = Array.map recip $ takeDiagonal $ vlAdj <#> vr
 a == vr <#> diagonal d <#> diagonal 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.