dvda-0.4: Efficient automatic differentiation and code generation

Safe HaskellNone

Dvda.Algorithm.FunGraph

Synopsis

Documentation

data FunGraph f g a Source

Constructors

FunGraph 

Fields

fgInputs :: f Sym
 
fgOutputs :: g Node
 
fgReified :: [(Node, GExpr a Node)]
 
fgTopSort :: [(Node, GExpr a Node)]
 

newtype Node Source

Constructors

Node Int 

Instances

toFunGraph :: (Functor f, Foldable f, Traversable g) => f (Expr a) -> g (Expr a) -> IO (FunGraph f g a)Source

Take inputs and outputs and traverse the outputs reifying all expressions and creating a hashmap of StableNames. Once the hashmap is created, lookup the provided inputs and return a FunGraph which contains an expression graph, input/output indices, and other useful functions. StableNames may be non-deterministic so this function may return graphs with greater or fewer CSE's eliminated. If CSE is then performed on the graph, the result is deterministic.