futhark-0.25.31: An optimising compiler for a functional, array-oriented language.
Safe HaskellNone
LanguageGHC2021

Language.Futhark.Interpreter.AD

Synopsis

Documentation

data Op Source #

Instances

Instances details
Show Op Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

Methods

showsPrec :: Int -> Op -> ShowS #

show :: Op -> String #

showList :: [Op] -> ShowS #

data ADVariable Source #

Constructors

VJP VJPValue 
JVP JVPValue 

Instances

Instances details
Show ADVariable Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

data ADValue Source #

Instances

Instances details
Show ADValue Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

data Tape Source #

Represents a computation tree, as well as every intermediate value in its evaluation.

Constructors

TapeID Counter ADValue

This represents a variable. Each variable is given a unique ID, and has an initial value

TapeConst ADValue

This represents a constant.

TapeOp Op [Tape] Counter ADValue

This represents the application of a mathematical operation. Each parameter is given by its Tape, and the return value of the operation is saved

Instances

Instances details
Show Tape Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

Methods

showsPrec :: Int -> Tape -> ShowS #

show :: Tape -> String #

showList :: [Tape] -> ShowS #

newtype VJPValue Source #

Constructors

VJPValue Tape 

Instances

Instances details
Show VJPValue Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

data JVPValue Source #

In JVP, the derivative of the variable must be saved. This is represented as a second value.

Constructors

JVPValue ADValue ADValue 

Instances

Instances details
Show JVPValue Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

newtype Counter Source #

Used to uniquely identify values.

Constructors

Counter Int 

newtype Depth Source #

An indication of the nesting depth of AD. This is used to avoid pertubation confusion.

Constructors

Depth Int 

Instances

Instances details
Show Depth Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

Methods

showsPrec :: Int -> Depth -> ShowS #

show :: Depth -> String #

showList :: [Depth] -> ShowS #

Eq Depth Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

Methods

(==) :: Depth -> Depth -> Bool #

(/=) :: Depth -> Depth -> Bool #

Ord Depth Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

Methods

compare :: Depth -> Depth -> Ordering #

(<) :: Depth -> Depth -> Bool #

(<=) :: Depth -> Depth -> Bool #

(>) :: Depth -> Depth -> Bool #

(>=) :: Depth -> Depth -> Bool #

max :: Depth -> Depth -> Depth #

min :: Depth -> Depth -> Depth #

tapePrimal :: Tape -> ADValue Source #

Returns the primal value of a Tape.

deriveTape :: Tape -> ADValue -> Counter -> Either String (Map Counter ADValue, Counter) Source #

This calculates every partial derivative of a Tape. The result is a map of the partial derivatives, each key corresponding to the ID of a free variable (see TapeID).

unionWithM :: (Monad m, Ord k) => (a -> a -> m a) -> Map k a -> Map k a -> m (Map k a) Source #

unionsWithM :: (Foldable f, Monad m, Ord k) => (a -> a -> m a) -> f (Map k a) -> m (Map k a) Source #