Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- type Free f = (Foldable1 f, Representable f, Eq (Rep f))
- lensRep :: Eq (Rep f) => Representable f => Rep f -> forall g. Functor g => (a -> g a) -> f a -> g (f a)
- grateRep :: Representable f => forall g. Functor g => (Rep f -> g a -> b) -> g (f a) -> f b
- fempty :: Monoid a => Representable f => f a
- neg :: Group a => Functor f => f a -> f a
- sum :: Semigroup a => Representable f => f a -> f a -> f a
- diff :: Group a => Representable f => f a -> f a -> f a
- outer :: Semiring a => Functor f => Functor g => f a -> g a -> f (g a)
- (<.>) :: Semiring a => Free f => f a -> f a -> a
- quadrance :: Semiring a => Free f => f a -> a
- qd :: Ring a => Free f => f a -> f a -> a
- lerp :: Ring a => Representable f => a -> f a -> f a -> f a
- dirac :: Eq i => Unital a => i -> i -> a
- unit :: Unital a => Free f => Rep f -> f a
Documentation
type Free f = (Foldable1 f, Representable f, Eq (Rep f)) Source #
Free semimodule over a generating set.
See https://en.wikipedia.org/wiki/Free_module and https://en.wikipedia.org/wiki/Semimodule.
lensRep :: Eq (Rep f) => Representable f => Rep f -> forall g. Functor g => (a -> g a) -> f a -> g (f a) Source #
grateRep :: Representable f => forall g. Functor g => (Rep f -> g a -> b) -> g (f a) -> f b Source #
fempty :: Monoid a => Representable f => f a Source #
The zero vector.
neg :: Group a => Functor f => f a -> f a Source #
Negation of a vector.
>>>
neg (V2 2 4)
V2 (-2) (-4)
sum :: Semigroup a => Representable f => f a -> f a -> f a infixl 6 Source #
Sum of two vectors.
>>>
V2 1 2 `sum` V2 3 4
V2 4 6
>>>
V2 1 2 <> V2 3 4
V2 4 6
>>>
V2 (V2 1 2) (V2 3 4) <> V2 (V2 1 2) (V2 3 4)
V2 (V2 2 4) (V2 6 8)
diff :: Group a => Representable f => f a -> f a -> f a infixl 6 Source #
Difference between two vectors.
>>>
V2 4 5 `diff` V2 3 1
V2 1 4
>>>
V2 4 5 << V2 3 1
V2 1 4
outer :: Semiring a => Functor f => Functor g => f a -> g a -> f (g a) Source #
Outer (tensor) product.
qd :: Ring a => Free f => f a -> f a -> a Source #
Squared l2 norm of the difference between two vectors.
lerp :: Ring a => Representable f => a -> f a -> f a -> f a Source #
Linearly interpolate between two vectors.