ad-3.2.1: Automatic Differentiation

PortabilityGHC only
Stabilityexperimental
Maintainerekmett@gmail.com
Safe HaskellNone

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 nth derivatives -- (n + k - 1) choose k for functions of k 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)

Documentation

data Dense f a Source

Constructors

Lift !a 
Dense !a (f a) 
Zero 

Instances

(Mode (Dense f), Mode (D (Dense f)), Traversable f, Lifted (Dense f)) => Jacobian (Dense f) 
Primal (Dense f) 
(Traversable f, Lifted (Dense f)) => Mode (Dense f) 
Traversable f => Lifted (Dense f) 
Show a => Show (Dense f a) 

ds :: f a -> AD (Dense f) a -> f aSource

ds' :: Num a => f a -> AD (Dense f) a -> (a, f a)Source

vars :: (Traversable f, Num a) => f a -> f (AD (Dense f) a)Source

apply :: (Traversable f, Num a) => (f (AD (Dense f) a) -> b) -> f a -> bSource