Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- type (**) f g = Compose f g
- type (++) f g = Product f g
- type Dim b c = forall a. Tran a b c
- type Endo a b = Tran a b b
- newtype Tran a b c = Tran {
- runTran :: (c -> a) -> b -> a
- app :: Basis2 b c f g => Tran a b c -> g a -> f a
- arr :: (b -> c) -> Tran a b c
- invmap :: (a1 -> a2) -> (a2 -> a1) -> Tran a1 b c -> Tran a2 b c
- rows :: Basis2 b c f g => g a -> (f ** g) a
- cols :: Basis2 b c f g => f a -> (f ** g) a
- projl :: Basis2 b c f g => (f ++ g) a -> f a
- projr :: Basis2 b c f g => (f ++ g) a -> g a
- compl :: Basis3 b c d f1 f2 g => Dim b c -> (f2 ** g) a -> (f1 ** g) a
- compr :: Basis3 b c d f g1 g2 => Dim c d -> (f ** g2) a -> (f ** g1) a
- complr :: Basis2 b1 c1 f1 f2 => Basis2 b2 c2 g1 g2 => Dim b1 c1 -> Dim b2 c2 -> (f2 ** g2) a -> (f1 ** g1) a
- transpose :: Basis2 b c f g => (f ** g) a -> (g ** f) a
- braid :: Dim (a, b) (b, a)
- sbraid :: Dim (a + b) (b + a)
- first :: Dim b c -> Dim (b, d) (c, d)
- second :: Dim b c -> Dim (d, b) (d, c)
- left :: Dim b c -> Dim (b + d) (c + d)
- right :: Dim b c -> Dim (d + b) (d + c)
- (***) :: Dim a1 b1 -> Dim a2 b2 -> Dim (a1, a2) (b1, b2)
- (+++) :: Dim a1 b1 -> Dim a2 b2 -> Dim (a1 + a2) (b1 + b2)
- (&&&) :: Dim a b1 -> Dim a b2 -> Dim a (b1, b2)
- (|||) :: Dim a1 b -> Dim a2 b -> Dim (a1 + a2) b
- ($$$) :: Dim a (b -> c) -> Dim a b -> Dim a c
- adivide :: (a -> (a1, a2)) -> Dim a1 b -> Dim a2 b -> Dim a b
- adivide' :: Dim a1 b -> Dim a2 b -> Dim (a1, a2) b
- aselect :: ((b1 + b2) -> b) -> Dim a b1 -> Dim a b2 -> Dim a b
- aselect' :: Dim a b1 -> Dim a b2 -> Dim a (b1 + b2)
Types
type Dim b c = forall a. Tran a b c Source #
A dimensional (binary) relation between two bases.
relations correspond to (compositions of)
permutation, projection, and embedding transformations.Dim
b c
A morphism between free semimodules indexed with bases b and c.
invmap :: (a1 -> a2) -> (a2 -> a1) -> Tran a1 b c -> Tran a2 b c Source #
Tran a b c is an invariant functor on a.
Matrix combinators
rows :: Basis2 b c f g => g a -> (f ** g) a Source #
Obtain a matrix by stacking rows.
>>>
rows (V2 1 2) :: M22 Int
V2 (V2 1 2) (V2 1 2)
cols :: Basis2 b c f g => f a -> (f ** g) a Source #
Obtain a matrix by stacking columns.
>>>
cols (V2 1 2) :: M22 Int
V2 (V2 1 1) (V2 2 2)
projl :: Basis2 b c f g => (f ++ g) a -> f a Source #
Project onto the left-hand component of a direct sum.
projr :: Basis2 b c f g => (f ++ g) a -> g a Source #
Project onto the right-hand component of a direct sum.
compl :: Basis3 b c d f1 f2 g => Dim b c -> (f2 ** g) a -> (f1 ** g) a Source #
Left (post) composition with a linear transformation.
compr :: Basis3 b c d f g1 g2 => Dim c d -> (f ** g2) a -> (f ** g1) a Source #
Right (pre) composition with a linear transformation.
complr :: Basis2 b1 c1 f1 f2 => Basis2 b2 c2 g1 g2 => Dim b1 c1 -> Dim b2 c2 -> (f2 ** g2) a -> (f1 ** g1) a Source #
Left and right composition with a linear transformation.
complr
f g =compl
f>>>
compr
g
When f . g = id this induces a similarity transformation:
>>>
perm1 = arr (+ E32)
>>>
perm2 = arr (+ E33)
>>>
m = m33 1 2 3 4 5 6 7 8 9 :: M33 Int
>>>
complr perm1 perm2 m :: M33 Int
V3 (V3 5 6 4) (V3 8 9 7) (V3 2 3 1)
See also https://en.wikipedia.org/wiki/Matrix_similarity & https://en.wikipedia.org/wiki/Conjugacy_class.
transpose :: Basis2 b c f g => (f ** g) a -> (g ** f) a Source #
Transpose a matrix.
>>>
transpose (V3 (V2 1 2) (V2 3 4) (V2 5 6))
V2 (V3 1 3 5) (V3 2 4 6)
>>>
transpose $ m23 1 2 3 4 5 6 :: M32 Int
V3 (V2 1 4) (V2 2 5) (V2 3 6)
Dimensional combinators
second :: Dim b c -> Dim (d, b) (d, c) Source #
Lift a transform into a transform on tensor products.
(***) :: Dim a1 b1 -> Dim a2 b2 -> Dim (a1, a2) (b1, b2) infixr 3 Source #
Create a transform on a tensor product of semimodules.