| Copyright | (c) Fabricio Olivetti 2021 - 2024 |
|---|---|
| License | BSD3 |
| Maintainer | fabricio.olivetti@gmail.com |
| Stability | experimental |
| Portability | FlexibleInstances, DeriveFunctor, ScopedTypeVariables |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Algorithm.SRTree.AD
Description
Automatic Differentiation for Expression trees
Synopsis
- forwardMode :: Array S Ix2 Double -> Array S Ix1 Double -> SRVector -> Fix SRTree -> (Array D Ix1 Double, Array S Ix1 Double)
- forwardModeUnique :: SRMatrix -> PVector -> SRVector -> Fix SRTree -> (SRVector, Array S Ix1 Double)
- reverseModeUnique :: SRMatrix -> PVector -> SRVector -> (SRVector -> SRVector) -> Fix SRTree -> (Array D Ix1 Double, Array S Ix1 Double)
- forwardModeUniqueJac :: SRMatrix -> PVector -> Fix SRTree -> [PVector]
Documentation
forwardMode :: Array S Ix2 Double -> Array S Ix1 Double -> SRVector -> Fix SRTree -> (Array D Ix1 Double, Array S Ix1 Double) #
Calculates the results of the error vector multiplied by the Jacobian of an expression using forward mode
provided a vector of variable values xss, a vector of parameter values theta and
a function that changes a Double value to the type of the variable values.
uses unsafe operations to use mutable array instead of a tape
forwardModeUnique :: SRMatrix -> PVector -> SRVector -> Fix SRTree -> (SRVector, Array S Ix1 Double) #
The function forwardModeUnique calculates the numerical gradient of the tree and evaluates the tree at the same time. It assumes that each parameter has a unique occurrence in the expression. This should be significantly faster than forwardMode.
reverseModeUnique :: SRMatrix -> PVector -> SRVector -> (SRVector -> SRVector) -> Fix SRTree -> (Array D Ix1 Double, Array S Ix1 Double) #
Same as above, but using reverse mode, that is even faster.
forwardModeUniqueJac :: SRMatrix -> PVector -> Fix SRTree -> [PVector] #
The function forwardModeUnique calculates the numerical gradient of the tree and evaluates the tree at the same time. It assumes that each parameter has a unique occurrence in the expression. This should be significantly faster than forwardMode.