ad-4.2.0.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

(Traversable f, Num a, Bounded a) => Bounded (Dense f a) 
(Traversable f, Num a, Enum a) => Enum (Dense f a) 
(Traversable f, Num a, Eq a) => Eq (Dense f a) 
(Traversable f, Floating a) => Floating (Dense f a) 
(Traversable f, Fractional a) => Fractional (Dense f a) 
(Traversable f, Num a) => Num (Dense f a) 
(Traversable f, Num a, Ord a) => Ord (Dense f a) 
(Traversable f, Real a) => Real (Dense f a) 
(Traversable f, RealFloat a) => RealFloat (Dense f a) 
(Traversable f, RealFrac a) => RealFrac (Dense f a) 
Show a => Show (Dense f a) 
(Traversable f, Erf a) => Erf (Dense f a) 
(Traversable f, InvErf a) => InvErf (Dense f a) 
(Num a, Traversable f) => Mode (Dense f a) 
(Traversable f, Num a) => Jacobian (Dense f a) 

ds :: f a -> Dense f a -> f aSource

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

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

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