ad-3.2: Automatic Differentiation

PortabilityGHC only
Stabilityexperimental
Maintainerekmett@gmail.com
Safe HaskellNone

Numeric.AD.Internal.Var

Description

Reverse-Mode Automatic Differentiation using a single tape.

This version uses Data.Reflection to update a single tape.

This is asymptotically faster than using Reverse, which is forced to reify and topologically sort the graph, but it is less friendly to the use of sparks.

Synopsis

Documentation

class Primal v => Var v whereSource

Used to mark variables for inspection during the reverse pass

Methods

var :: a -> Int -> v aSource

varId :: v a -> IntSource

Instances

Var Variable 
Var Reverse 
(Primal (AD f), Var f) => Var (AD f) 
Primal (Wengert s) => Var (Wengert s) 

bind :: (Traversable f, Var v) => f a -> (f (v a), (Int, Int))Source

unbind :: (Functor f, Var v) => f (v a) -> Array Int a -> f aSource

unbindMap :: (Functor f, Var v, Num a) => f (v a) -> IntMap a -> f aSource

unbindWith :: (Functor f, Var v, Num a) => (a -> b -> c) -> f (v a) -> Array Int b -> f cSource

unbindMapWithDefault :: (Functor f, Var v, Num a) => b -> (a -> b -> c) -> f (v a) -> IntMap b -> f cSource

data Variable a Source

Constructors

Variable a !Int 

vary :: Var f => Variable a -> f aSource