Safe Haskell | None |
---|
- data family Matrix typ a
- type ArrayMatrix shape = Matrix (Array shape)
- data Array shape
- type Full vert horiz height width = ArrayMatrix (Full vert horiz height width)
- type General height width = ArrayMatrix (General height width)
- type Tall height width = ArrayMatrix (Tall height width)
- type Wide height width = ArrayMatrix (Wide height width)
- type Square sh = ArrayMatrix (Square sh)
- shape :: ArrayMatrix sh a -> sh
- reshape :: (C sh0, C sh1) => sh1 -> ArrayMatrix sh0 a -> ArrayMatrix sh1 a
- mapShape :: (C sh0, C sh1) => (sh0 -> sh1) -> ArrayMatrix sh0 a -> ArrayMatrix sh1 a
- toVector :: ArrayMatrix sh a -> Array sh a
- fromVector :: (Admissible sh, Floating a) => Array sh a -> ArrayMatrix sh a
- lift0 :: Array shA a -> ArrayMatrix shA a
- lift1 :: (Array shA a -> Array shB b) -> ArrayMatrix shA a -> ArrayMatrix shB b
- lift2 :: (Array shA a -> Array shB b -> Array shC c) -> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c
- lift3 :: (Array shA a -> Array shB b -> Array shC c -> Array shD d) -> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c -> ArrayMatrix shD d
- lift4 :: (Array shA a -> Array shB b -> Array shC c -> Array shD d -> Array shE e) -> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c -> ArrayMatrix shD d -> ArrayMatrix shE e
- unlift1 :: (ArrayMatrix shA a -> ArrayMatrix shB b) -> Array shA a -> Array shB b
- unlift2 :: (ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c) -> Array shA a -> Array shB b -> Array shC c
- unliftRow :: Order -> (General () height0 a -> General () height1 b) -> Vector height0 a -> Vector height1 b
- unliftColumn :: Order -> (General height0 () a -> General height1 () b) -> Vector height0 a -> Vector height1 b
- class C shape => Homogeneous shape
- zero :: (Homogeneous shape, Floating a) => shape -> ArrayMatrix shape a
- negate :: (Homogeneous shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a
- scaleReal :: (Homogeneous shape, Floating a) => RealOf a -> ArrayMatrix shape a -> ArrayMatrix shape a
- scale :: (Scale shape, Floating a) => a -> ArrayMatrix shape a -> ArrayMatrix shape a
- scaleRealReal :: (Homogeneous shape, Real a) => a -> ArrayMatrix shape a -> ArrayMatrix shape a
- (.*#) :: (Scale shape, Floating a) => a -> ArrayMatrix shape a -> ArrayMatrix shape a
- class C shape => ShapeOrder shape where
- shapeOrder :: shape -> Order
- forceOrder :: (ShapeOrder shape, Floating a) => Order -> ArrayMatrix shape a -> ArrayMatrix shape a
- adaptOrder :: (ShapeOrder shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a
- class (Homogeneous shape, Eq shape) => Additive shape
- add :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a
- sub :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a
- (#+#) :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a
- (#-#) :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape a
- class C shape => Complex shape
- class (Box shape, HeightOf shape ~ WidthOf shape) => SquareShape shape
- class Box shape => MultiplyVector shape
- class SquareShape shape => MultiplySquare shape
- class SquareShape shape => Power shape
- class (C shapeA, C shapeB) => Multiply shapeA shapeB
- class SquareShape shape => Determinant shape
- class SquareShape shape => Solve shape
- class (Solve shape, Power shape) => Inverse shape
Documentation
type ArrayMatrix shape = Matrix (Array shape)Source
Box sh => Box (Array sh) | |
MultiplySame sh => MultiplySame (Array sh) | |
FormatArray sh => FormatMatrix (Array sh) | |
NFData shape => NFData (Array shape) | |
Indexed sh => Indexed (Array sh) | |
Power shape => Power (Array shape) | |
MultiplySquare shape => MultiplySquare (Array shape) | |
MultiplyVector shape => MultiplyVector (Array shape) | |
Inverse shape => Inverse (Array shape) | |
Solve shape => Solve (Array shape) | |
Determinant shape => Determinant (Array shape) | |
SquareShape sh => SquareShape (Array sh) | |
Complex sh => Complex (Array sh) | |
(C shapeA, Eq shapeA, ~ * shapeA (HeightOf shapeB), Box shapeB, Scale shapeB) => Multiply (Scale shapeA) (Array shapeB) | |
(Box shapeA, Scale shapeA, ~ * (WidthOf shapeA) shapeB, C shapeB, Eq shapeB) => Multiply (Array shapeA) (Scale shapeB) | |
(Box shapeA, Box shapeB, Multiply shapeA shapeB) => Multiply (Array shapeA) (Array shapeB) | |
(Show shape, Show a, Storable a, C shape) => Show (Matrix (Array shape) a) |
type Full vert horiz height width = ArrayMatrix (Full vert horiz height width)Source
type General height width = ArrayMatrix (General height width)Source
type Tall height width = ArrayMatrix (Tall height width)Source
type Wide height width = ArrayMatrix (Wide height width)Source
type Square sh = ArrayMatrix (Square sh)Source
shape :: ArrayMatrix sh a -> shSource
reshape :: (C sh0, C sh1) => sh1 -> ArrayMatrix sh0 a -> ArrayMatrix sh1 aSource
mapShape :: (C sh0, C sh1) => (sh0 -> sh1) -> ArrayMatrix sh0 a -> ArrayMatrix sh1 aSource
toVector :: ArrayMatrix sh a -> Array sh aSource
fromVector :: (Admissible sh, Floating a) => Array sh a -> ArrayMatrix sh aSource
lift0 :: Array shA a -> ArrayMatrix shA aSource
lift0
is a synonym for fromVector
but lacks the admissibility check.
You may thus fool the type tags.
This applies to the other lift functions, too.
lift1 :: (Array shA a -> Array shB b) -> ArrayMatrix shA a -> ArrayMatrix shB bSource
lift2 :: (Array shA a -> Array shB b -> Array shC c) -> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC cSource
lift3 :: (Array shA a -> Array shB b -> Array shC c -> Array shD d) -> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c -> ArrayMatrix shD dSource
lift4 :: (Array shA a -> Array shB b -> Array shC c -> Array shD d -> Array shE e) -> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c -> ArrayMatrix shD d -> ArrayMatrix shE eSource
unlift1 :: (ArrayMatrix shA a -> ArrayMatrix shB b) -> Array shA a -> Array shB bSource
unlift2 :: (ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c) -> Array shA a -> Array shB b -> Array shC cSource
unliftRow :: Order -> (General () height0 a -> General () height1 b) -> Vector height0 a -> Vector height1 bSource
unliftColumn :: Order -> (General height0 () a -> General height1 () b) -> Vector height0 a -> Vector height1 bSource
class C shape => Homogeneous shape Source
C size => Homogeneous (Hermitian size) | |
(Natural off, C size) => Homogeneous (BandedHermitian off size) | |
(Content lo, ~ * NonUnit diag, Content up, C size) => Homogeneous (Triangular lo diag up size) | |
(C vert, C horiz, C height, C width) => Homogeneous (Full vert horiz height width) | |
(Natural sub, Natural super, C vert, C horiz, C height, C width) => Homogeneous (Banded sub super vert horiz height width) |
zero :: (Homogeneous shape, Floating a) => shape -> ArrayMatrix shape aSource
negate :: (Homogeneous shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape aSource
scaleReal :: (Homogeneous shape, Floating a) => RealOf a -> ArrayMatrix shape a -> ArrayMatrix shape aSource
scale :: (Scale shape, Floating a) => a -> ArrayMatrix shape a -> ArrayMatrix shape aSource
scaleRealReal :: (Homogeneous shape, Real a) => a -> ArrayMatrix shape a -> ArrayMatrix shape aSource
(.*#) :: (Scale shape, Floating a) => a -> ArrayMatrix shape a -> ArrayMatrix shape aSource
class C shape => ShapeOrder shape whereSource
shapeOrder :: shape -> OrderSource
C size => ShapeOrder (Hermitian size) | |
(Content lo, TriDiag diag, Content up, C size) => ShapeOrder (Triangular lo diag up size) | |
(C vert, C horiz, C height, C width) => ShapeOrder (Full vert horiz height width) |
forceOrder :: (ShapeOrder shape, Floating a) => Order -> ArrayMatrix shape a -> ArrayMatrix shape aSource
adaptOrder :: (ShapeOrder shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape aSource
adaptOrder x y
contains the data of y
with the layout of x
.
class (Homogeneous shape, Eq shape) => Additive shape Source
add :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape aSource
sub :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape aSource
(#+#) :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape aSource
(#-#) :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape aSource
class C shape => Complex shape Source
C size => Complex (Hermitian size) | |
(Natural off, C size) => Complex (BandedHermitian off size) | |
(Content lo, TriDiag diag, Content up, C size) => Complex (Triangular lo diag up size) | |
(C vert, C horiz, C height, C width) => Complex (Full vert horiz height width) | |
(Natural sub, Natural super, C vert, C horiz, C height, C width) => Complex (Banded sub super vert horiz height width) |
class (Box shape, HeightOf shape ~ WidthOf shape) => SquareShape shape Source
C size => SquareShape (Hermitian size) | |
(Natural offDiag, C size) => SquareShape (BandedHermitian offDiag size) | |
(Content lo, TriDiag diag, Content up, C size) => SquareShape (Triangular lo diag up size) | |
(~ * Small vert, ~ * Small horiz, C height, ~ * height width) => SquareShape (Full vert horiz height width) | |
(Natural sub, Natural super, ~ * Small vert, ~ * Small horiz, C height, ~ * height width) => SquareShape (Banded sub super vert horiz height width) |
class Box shape => MultiplyVector shape Source
C shape => MultiplyVector (Hermitian shape) | |
(Natural offDiag, C size) => MultiplyVector (BandedHermitian offDiag size) | |
(Content lo, Content up, TriDiag diag, C shape) => MultiplyVector (Triangular lo diag up shape) | |
(C vert, C horiz, C width, C height) => MultiplyVector (Full vert horiz height width) | |
(Natural sub, Natural super, C vert, C horiz, C height, C width) => MultiplyVector (Banded sub super vert horiz height width) |
class SquareShape shape => MultiplySquare shape Source
C shape => MultiplySquare (Hermitian shape) | |
(Natural offDiag, C size) => MultiplySquare (BandedHermitian offDiag size) | |
(Content lo, Content up, TriDiag diag, C shape) => MultiplySquare (Triangular lo diag up shape) | |
(~ * vert Small, ~ * horiz Small, C height, ~ * height width) => MultiplySquare (Full vert horiz height width) | |
(Natural sub, Natural super, ~ * vert Small, ~ * horiz Small, C height, ~ * height width) => MultiplySquare (Banded sub super vert horiz height width) |
class SquareShape shape => Power shape Source
class (C shapeA, C shapeB) => Multiply shapeA shapeB Source
This class allows to Basic.multiply two matrices of arbitrary special features
and returns the most special matrix type possible.
At the first glance, this is handy.
At the second glance, this has some problems.
First of all, we may refine the types in future
and then multiplication may return a different, more special type than before.
Second, if you write code with polymorphic matrix types,
then matrixMatrix
may leave you with constraints like
ExtentPriv.Multiply vert vert ~ vert
.
That constraint is always fulfilled but the compiler cannot infer that.
Because of these problems
you may instead consider using specialised multiply
functions
from the various modules for production use.
Btw. MultiplyVector
and MultiplySquare
are much less problematic,
because the input and output are always dense vectors or dense matrices.
(C shapeA, ~ * shapeA shapeB, Eq shapeB) => Multiply (Hermitian shapeA) (Hermitian shapeB) | |
(C vert, C horiz, C size, ~ * size height, Eq height, C width) => Multiply (Hermitian size) (Full vert horiz height width) | |
(Natural offDiagA, Natural offDiagB, C sizeA, ~ * sizeA sizeB, C sizeB, Eq sizeB) => Multiply (BandedHermitian offDiagA sizeA) (BandedHermitian offDiagB sizeB) | |
(Natural offDiag, C vert, C horiz, C size, ~ * size height, Eq height, C width, Eq width) => Multiply (BandedHermitian offDiag size) (Full vert horiz height width) | |
(Natural offDiag, Natural sub, Natural super, C vert, C horiz, C size, ~ * size height, Eq height, C width, Eq width) => Multiply (BandedHermitian offDiag size) (Banded sub super vert horiz height width) | |
(C vert, C horiz, C size, ~ * size width, Eq width, C height) => Multiply (Full vert horiz height width) (Hermitian size) | |
(Natural offDiag, C vert, C horiz, C size, ~ * size width, Eq width, C height, Eq height) => Multiply (Full vert horiz height width) (BandedHermitian offDiag size) | |
(C sizeA, ~ * sizeA sizeB, Eq sizeB, MultiplyTriangular loA upA loB upB, TriDiag diagA, TriDiag diagB) => Multiply (Triangular loA diagA upA sizeA) (Triangular loB diagB upB sizeB) | |
(Content lo, Content up, TriDiag diag, C vert, C horiz, C size, ~ * size height, Eq height, C width) => Multiply (Triangular lo diag up size) (Full vert horiz height width) | |
(Content lo, Content up, TriDiag diag, C vert, C horiz, C size, ~ * size width, Eq width, C height) => Multiply (Full vert horiz height width) (Triangular lo diag up size) | |
(C heightA, C widthA, C widthB, ~ * widthA heightB, Eq heightB, C vertA, C horizA, C vertB, C horizB) => Multiply (Full vertA horizA heightA widthA) (Full vertB horizB heightB widthB) | |
(Natural sub, Natural super, C vertA, C horizA, C vertB, C horizB, C heightA, C widthA, C widthB, ~ * widthA heightB, Eq heightB) => Multiply (Full vertA horizA heightA widthA) (Banded sub super vertB horizB heightB widthB) | |
(Natural offDiag, Natural sub, Natural super, C vert, C horiz, C size, ~ * size width, Eq width, C height, Eq height) => Multiply (Banded sub super vert horiz height width) (BandedHermitian offDiag size) | |
(Natural sub, Natural super, C vertA, C horizA, C vertB, C horizB, C heightA, C widthA, C widthB, ~ * widthA heightB, Eq heightB) => Multiply (Banded sub super vertA horizA heightA widthA) (Full vertB horizB heightB widthB) | |
(Natural subA, Natural superA, Natural subB, Natural superB, C vertA, C horizA, C vertB, C horizB, C heightA, C widthA, C widthB, ~ * widthA heightB, Eq heightB) => Multiply (Banded subA superA vertA horizA heightA widthA) (Banded subB superB vertB horizB heightB widthB) |
class SquareShape shape => Determinant shape Source
C shape => Determinant (Hermitian shape) | |
(Natural offDiag, C size) => Determinant (BandedHermitian offDiag size) | There is no solver for general banded Hermitian matrices. Thus the instance will fail for an indefinite matrix. |
(Content lo, Content up, TriDiag diag, C shape) => Determinant (Triangular lo diag up shape) | |
(~ * vert Small, ~ * horiz Small, C height, ~ * height width) => Determinant (Full vert horiz height width) | |
(Natural sub, Natural super, ~ * vert Small, ~ * horiz Small, C width, C height, ~ * width height) => Determinant (Banded sub super vert horiz height width) |
class SquareShape shape => Solve shape Source
C shape => Solve (Hermitian shape) | |
(Natural offDiag, C size) => Solve (BandedHermitian offDiag size) | There is no solver for indefinite matrices. Thus the instance will fail for indefinite but solvable systems. |
(Content lo, Content up, TriDiag diag, C shape) => Solve (Triangular lo diag up shape) | |
(~ * vert Small, ~ * horiz Small, C height, ~ * height width) => Solve (Full vert horiz height width) | |
(Natural sub, Natural super, ~ * vert Small, ~ * horiz Small, C width, C height, ~ * width height) => Solve (Banded sub super vert horiz height width) |