| Copyright | (c) Lars Brünjes, 2016 |
|---|---|
| License | MIT |
| Maintainer | brunjlar@gmail.com |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell2010 |
| Extensions |
|
Data.Utils.Analytic
Description
Documentation
class (Floating a, Ord a) => Analytic a where Source #
Class Analytic is a helper class for defining differentiable functions.
Minimal complete definition
Methods
fromDouble :: Double -> a Source #
Type can be thought of as the type of "differentiable" functions Diff f gf Double -> g Double.
type Diff' = forall a. Analytic a => a -> a Source #
Type can be thought of as the type of differentiable functions
Diff'Double -> Double.
diff :: Functor f => Diff' -> Diff f f Source #
Lifts a differentiable function by pointwise application.
Arguments
| :: Traversable t | |
| => (Double -> Double -> a) | how to combine argument and gradient |
| -> Diff t Identity | differentiable function |
| -> t Double | function argument |
| -> (Double, t a) | function value and combination of argument and gradient |
Computes the gradient of an analytic function and combines it with the argument.
>>>gradWith' (\_ d -> d) (Diff $ \[x, y] -> Identity $ x * x + 3 * y + 7) [2, 1](14.0,[4.0,3.0])