| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Data.Semimodule.Transform
Synopsis
- type (**) f g = Compose f g
- type (++) f g = Product f g
- newtype Dual a c = Dual {
- runDual :: (c -> a) -> a
- image' :: Semiring a => Foldable f => f (a, c) -> Dual a c
- toTran :: (b -> Dual a c) -> Tran a b c
- fromTran :: Tran a b c -> b -> Dual a c
- (!*) :: Free f => Dual a (Rep f) -> f a -> a
- (*!) :: Free f => f a -> Dual a (Rep f) -> a
- type Endo a b = Tran a b b
- image :: Semiring a => (b -> [(a, c)]) -> Tran a b c
- (!#) :: Free f => Free g => Tran a (Rep f) (Rep g) -> g a -> f a
- (#!) :: Free f => Free g => g a -> Tran a (Rep f) (Rep g) -> f a
- (!#!) :: Tran a c d -> Tran a b c -> Tran a b d
- dimap' :: (b1 -> b2) -> (c1 -> c2) -> Tran a b2 c1 -> Tran a b1 c2
- lmap' :: (b1 -> b2) -> Tran a b2 c -> Tran a b1 c
- rmap' :: (c1 -> c2) -> Tran a b c1 -> Tran a b c2
- invmap :: (a1 -> a2) -> (a2 -> a1) -> Tran a1 b c -> Tran a2 b c
- braid :: Tran a (b, c) (c, b)
- cobraid :: Tran a (b + c) (c + b)
- commutator :: (Additive - Group) a => Endo a b -> Endo a b -> Endo a b
- split :: (b -> (b1, b2)) -> Tran a b1 c -> Tran a b2 c -> Tran a b c
- cosplit :: ((c1 + c2) -> c) -> Tran a b c1 -> Tran a b c2 -> Tran a b c
- projl :: Free f => Free g => (f ++ g) a -> f a
- projr :: Free f => Free g => (f ++ g) a -> g a
- compl :: Free f1 => Free f2 => Free g => Tran a (Rep f1) (Rep f2) -> (f2 ** g) a -> (f1 ** g) a
- compr :: Free f => Free g1 => Free g2 => Tran a (Rep g1) (Rep g2) -> (f ** g2) a -> (f ** g1) a
- complr :: Free f1 => Free f2 => Free g1 => Free g2 => Tran a (Rep f1) (Rep f2) -> Tran a (Rep g1) (Rep g2) -> (f2 ** g2) a -> (f1 ** g1) a
Documentation
Linear functionals from elements of a free semimodule to a scalar.
f!*(x+y) = (f!*x)+(f!*y) f!*(x.*a) = a*(f!*x)
Caution: You must ensure these laws hold when using the default constructor.
Instances
image' :: Semiring a => Foldable f => f (a, c) -> Dual a c Source #
Create a Dual from a linear combination of basis vectors.
>>>image' [(2, E31),(3, E32)] !* V3 1 1 1 :: Int5
(!*) :: Free f => Dual a (Rep f) -> f a -> a infixr 3 Source #
Apply a linear functional to a vector.
(*!) :: Free f => f a -> Dual a (Rep f) -> a infixl 3 Source #
Apply a linear functional to a vector.
type Endo a b = Tran a b b Source #
An endomorphism over a free semimodule.
>>>one + two !# V2 1 2 :: V2 DoubleV2 3.0 6.0
image :: Semiring a => (b -> [(a, c)]) -> Tran a b c Source #
Create a Tran from a linear combination of basis vectors.
>>>image (e2 [(2, E31),(3, E32)] [(1, E33)]) !# V3 1 1 1 :: V2 IntV2 5 1
(!#) :: Free f => Free g => Tran a (Rep f) (Rep g) -> g a -> f a infixr 2 Source #
Apply a transformation to a vector.
(#!) :: Free f => Free g => g a -> Tran a (Rep f) (Rep g) -> f a infixl 2 Source #
Apply a transformation to a vector.
dimap' :: (b1 -> b2) -> (c1 -> c2) -> Tran a b2 c1 -> Tran a b1 c2 Source #
Tran is a profunctor in the category of semimodules.
Caution: Arbitrary mapping functions may violate linearity.
>>>dimap' id (e3 True True False) (arr id) !# 4 :+ 5 :: V3 IntV3 5 5 4
invmap :: (a1 -> a2) -> (a2 -> a1) -> Tran a1 b c -> Tran a2 b c Source #
Tran is an invariant functor.
commutator :: (Additive - Group) a => Endo a b -> Endo a b -> Endo a b Source #
Commutator or Lie bracket of two semimodule endomorphisms.
projl :: Free f => Free g => (f ++ g) a -> f a Source #
Project onto the left-hand component of a direct sum.
projr :: Free f => Free g => (f ++ g) a -> g a Source #
Project onto the right-hand component of a direct sum.
compl :: Free f1 => Free f2 => Free g => Tran a (Rep f1) (Rep f2) -> (f2 ** g) a -> (f1 ** g) a Source #
Left (post) composition with a linear transformation.