Stability | experimental |
---|---|
Maintainer | conal@conal.net |
Safe Haskell | None |
Infinite derivative towers via linear maps, using the Maclaurin representation. See blog posts http://conal.net/blog/tag/derivatives/.
- data a :> b = D {
- powVal :: b
- derivative :: a :-* (a :> b)
- derivAtBasis :: (HasTrie (Basis a), HasBasis a, AdditiveGroup b) => (a :> b) -> Basis a -> a :> b
- type :~> a b = a -> a :> b
- pureD :: (AdditiveGroup b, HasBasis a, HasTrie (Basis a)) => b -> a :> b
- fmapD :: (HasBasis a, HasTrie (Basis a), AdditiveGroup b) => (b -> c) -> (a :> b) -> a :> c
- (<$>>) :: (HasBasis a, HasTrie (Basis a), AdditiveGroup b) => (b -> c) -> (a :> b) -> a :> c
- liftD2 :: (HasBasis a, HasTrie (Basis a), AdditiveGroup b, AdditiveGroup c) => (b -> c -> d) -> (a :> b) -> (a :> c) -> a :> d
- liftD3 :: (HasBasis a, HasTrie (Basis a), AdditiveGroup b, AdditiveGroup c, AdditiveGroup d) => (b -> c -> d -> e) -> (a :> b) -> (a :> c) -> (a :> d) -> a :> e
- idD :: (VectorSpace u, s ~ Scalar u, VectorSpace (u :> u), VectorSpace s, HasBasis u, HasTrie (Basis u)) => u :~> u
- fstD :: (HasBasis a, HasTrie (Basis a), HasBasis b, HasTrie (Basis b), Scalar a ~ Scalar b) => (a, b) :~> a
- sndD :: (HasBasis a, HasTrie (Basis a), HasBasis b, HasTrie (Basis b), Scalar a ~ Scalar b) => (a, b) :~> b
- linearD :: (HasBasis u, HasTrie (Basis u), AdditiveGroup v) => (u -> v) -> u :~> v
- distrib :: forall a b c u. (HasBasis a, HasTrie (Basis a), AdditiveGroup b, AdditiveGroup c, AdditiveGroup u) => (b -> c -> u) -> (a :> b) -> (a :> c) -> a :> u
- (>-<) :: (HasBasis a, HasTrie (Basis a), VectorSpace u, AdditiveGroup (Scalar u)) => (u -> u) -> ((a :> u) -> a :> Scalar u) -> (a :> u) -> a :> u
- pairD :: (HasBasis a, HasTrie (Basis a), VectorSpace b, VectorSpace c, Scalar b ~ Scalar c) => (a :> b, a :> c) -> a :> (b, c)
- unpairD :: (HasBasis a, HasTrie (Basis a), VectorSpace a, VectorSpace b, VectorSpace c, Scalar b ~ Scalar c) => (a :> (b, c)) -> (a :> b, a :> c)
- tripleD :: (HasBasis a, HasTrie (Basis a), VectorSpace b, VectorSpace c, VectorSpace d, Scalar b ~ Scalar c, Scalar c ~ Scalar d) => (a :> b, a :> c, a :> d) -> a :> (b, c, d)
- untripleD :: (HasBasis a, HasTrie (Basis a), VectorSpace a, VectorSpace b, VectorSpace c, VectorSpace d, Scalar b ~ Scalar c, Scalar c ~ Scalar d) => (a :> (b, c, d)) -> (a :> b, a :> c, a :> d)
Documentation
Tower of derivatives.
D | |
|
derivAtBasis :: (HasTrie (Basis a), HasBasis a, AdditiveGroup b) => (a :> b) -> Basis a -> a :> bSource
Sample the derivative at a basis element. Optimized for partial application to save work for non-scalar derivatives.
pureD :: (AdditiveGroup b, HasBasis a, HasTrie (Basis a)) => b -> a :> bSource
Constant derivative tower.
fmapD :: (HasBasis a, HasTrie (Basis a), AdditiveGroup b) => (b -> c) -> (a :> b) -> a :> cSource
Map a linear function over a derivative tower.
(<$>>) :: (HasBasis a, HasTrie (Basis a), AdditiveGroup b) => (b -> c) -> (a :> b) -> a :> cSource
Map a linear function over a derivative tower.
liftD2 :: (HasBasis a, HasTrie (Basis a), AdditiveGroup b, AdditiveGroup c) => (b -> c -> d) -> (a :> b) -> (a :> c) -> a :> dSource
Apply a linear binary function over derivative towers.
liftD3 :: (HasBasis a, HasTrie (Basis a), AdditiveGroup b, AdditiveGroup c, AdditiveGroup d) => (b -> c -> d -> e) -> (a :> b) -> (a :> c) -> (a :> d) -> a :> eSource
Apply a linear ternary function over derivative towers.
idD :: (VectorSpace u, s ~ Scalar u, VectorSpace (u :> u), VectorSpace s, HasBasis u, HasTrie (Basis u)) => u :~> uSource
Differentiable identity function. Sometimes called the derivation variable or similar, but it's not really a variable.
fstD :: (HasBasis a, HasTrie (Basis a), HasBasis b, HasTrie (Basis b), Scalar a ~ Scalar b) => (a, b) :~> aSource
Differentiable version of fst
sndD :: (HasBasis a, HasTrie (Basis a), HasBasis b, HasTrie (Basis b), Scalar a ~ Scalar b) => (a, b) :~> bSource
Differentiable version of snd
linearD :: (HasBasis u, HasTrie (Basis u), AdditiveGroup v) => (u -> v) -> u :~> vSource
Every linear function has a constant derivative equal to the function itself (as a linear map).
distrib :: forall a b c u. (HasBasis a, HasTrie (Basis a), AdditiveGroup b, AdditiveGroup c, AdditiveGroup u) => (b -> c -> u) -> (a :> b) -> (a :> c) -> a :> uSource
Derivative tower for applying a binary function that distributes over addition, such as multiplication. A bit weaker assumption than bilinearity. Is bilinearity necessary for correctness here?
(>-<) :: (HasBasis a, HasTrie (Basis a), VectorSpace u, AdditiveGroup (Scalar u)) => (u -> u) -> ((a :> u) -> a :> Scalar u) -> (a :> u) -> a :> uSource
Specialized chain rule. See also '(@.)'
Misc
pairD :: (HasBasis a, HasTrie (Basis a), VectorSpace b, VectorSpace c, Scalar b ~ Scalar c) => (a :> b, a :> c) -> a :> (b, c)Source
unpairD :: (HasBasis a, HasTrie (Basis a), VectorSpace a, VectorSpace b, VectorSpace c, Scalar b ~ Scalar c) => (a :> (b, c)) -> (a :> b, a :> c)Source
tripleD :: (HasBasis a, HasTrie (Basis a), VectorSpace b, VectorSpace c, VectorSpace d, Scalar b ~ Scalar c, Scalar c ~ Scalar d) => (a :> b, a :> c, a :> d) -> a :> (b, c, d)Source
untripleD :: (HasBasis a, HasTrie (Basis a), VectorSpace a, VectorSpace b, VectorSpace c, VectorSpace d, Scalar b ~ Scalar c, Scalar c ~ Scalar d) => (a :> (b, c, d)) -> (a :> b, a :> c, a :> d)Source