Copyright | (c) Edward Kmett 2010-2021 |
---|---|
License | BSD3 |
Maintainer | ekmett@gmail.com |
Stability | experimental |
Portability | GHC only |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Numeric.AD.Internal.Dense
Description
Dense Forward AD. Useful when the result involves the majority of the input
elements. Do not use for hessian
and beyond, since
they only contain a small number of unique n
th derivatives --
(n + k - 1)
for functions of choose
kk
inputs rather than the
k^n
that would be generated by using Dense
, not to mention the redundant
intermediate derivatives that would be
calculated over and over during that process!
Assumes all instances of f
have the same number of elements.
NB: We don't need the full power of Traversable
here, we could get
by with a notion of zippable that can plug in 0's for the missing
entries. This might allow for gradients where f
has exponentials like ((->) a)