Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data ReverseDouble s where
- Zero :: ReverseDouble s
- Lift :: Double -> ReverseDouble s
- ReverseDouble :: !Int -> Double -> ReverseDouble s
- newtype Tape = Tape {}
- data Head = Head !Int Cells
- data Cells where
- reifyTape :: Int -> (forall s. Reifies s Tape => Proxy s -> r) -> r
- partials :: forall s. Reifies s Tape => ReverseDouble s -> [Double]
- partialArrayOf :: Reifies s Tape => Proxy s -> (Int, Int) -> ReverseDouble s -> Array Int Double
- partialMapOf :: Reifies s Tape => Proxy s -> ReverseDouble s -> IntMap Double
- derivativeOf :: Reifies s Tape => Proxy s -> ReverseDouble s -> Double
- derivativeOf' :: Reifies s Tape => Proxy s -> ReverseDouble s -> (Double, Double)
- bind :: Traversable f => f Double -> (f (ReverseDouble s), (Int, Int))
- unbind :: Functor f => f (ReverseDouble s) -> Array Int Double -> f Double
- unbindMap :: Functor f => f (ReverseDouble s) -> IntMap Double -> f Double
- unbindWith :: Functor f => (Double -> b -> c) -> f (ReverseDouble s) -> Array Int b -> f c
- unbindMapWithDefault :: Functor f => b -> (Double -> b -> c) -> f (ReverseDouble s) -> IntMap b -> f c
- var :: Double -> Int -> ReverseDouble s
- varId :: ReverseDouble s -> Int
- primal :: ReverseDouble s -> Double
Documentation
data ReverseDouble s where Source #
Zero :: ReverseDouble s | |
Lift :: Double -> ReverseDouble s | |
ReverseDouble :: !Int -> Double -> ReverseDouble s |
Instances
reifyTape :: Int -> (forall s. Reifies s Tape => Proxy s -> r) -> r Source #
Construct a tape that starts with n
variables.
partials :: forall s. Reifies s Tape => ReverseDouble s -> [Double] Source #
Extract the partials from the current chain for a given AD variable.
partialArrayOf :: Reifies s Tape => Proxy s -> (Int, Int) -> ReverseDouble s -> Array Int Double Source #
partialMapOf :: Reifies s Tape => Proxy s -> ReverseDouble s -> IntMap Double Source #
Return an IntMap
of sparse partials
derivativeOf :: Reifies s Tape => Proxy s -> ReverseDouble s -> Double Source #
Helper that extracts the derivative of a chain when the chain was constructed with 1 variable.
derivativeOf' :: Reifies s Tape => Proxy s -> ReverseDouble s -> (Double, Double) Source #
Helper that extracts both the primal and derivative of a chain when the chain was constructed with 1 variable.
bind :: Traversable f => f Double -> (f (ReverseDouble s), (Int, Int)) Source #
unbindWith :: Functor f => (Double -> b -> c) -> f (ReverseDouble s) -> Array Int b -> f c Source #
unbindMapWithDefault :: Functor f => b -> (Double -> b -> c) -> f (ReverseDouble s) -> IntMap b -> f c Source #
varId :: ReverseDouble s -> Int Source #
primal :: ReverseDouble s -> Double Source #