dvda-0.3.0.1: Efficient automatic differentiation and code generation

Safe HaskellSafe-Infered

Dvda.FunGraph

Synopsis

Documentation

data FunGraph a Source

Instances

Show a => Show (FunGraph a) 

class ToFunGraph a Source

Associated Types

type NumT a Source

Instances

ToFunGraph [[Expr a]] 
ToFunGraph [Expr a] 
ToFunGraph (Expr a) 
(ToFunGraph a, ToFunGraph b, ~ * (NumT a) (NumT b)) => ToFunGraph (:* a b) 

data a :* b Source

Constructors

a :* b 

Instances

(Show a, Show b) => Show (:* a b) 
(ToFunGraph a, ToFunGraph b, ~ * (NumT a) (NumT b)) => ToFunGraph (:* a b) 

data MVS a Source

Constructors

Mat [[a]] 
Vec [a] 
Sca a 

Instances

toFunGraph :: (Eq a, Hashable a, Show a, ToFunGraph b, ToFunGraph c, NumT b ~ a, NumT c ~ a) => b -> c -> IO (FunGraph a)Source

Take inputs and outputs which are of classes ToFunGraph (heterogenous lists of Expr a) and traverse the outputs reifying all expressions and creating a hashmap of StableNames (stable pointers). 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 is non-deterministic so this function may return graphs with more or fewer CSE's eliminated. If CSE is then performed on the graph, the result is deterministic.