Copyright | (c) Edward Kmett 2010-2015 |
---|---|

License | BSD3 |

Maintainer | ekmett@gmail.com |

Stability | experimental |

Portability | GHC only |

Safe Haskell | None |

Language | Haskell2010 |

Higher order derivatives via a "dual number tower".

## Synopsis

- data AD s a
- data Tower a
- auto :: Mode t => Scalar t -> t
- taylor :: Fractional a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> a -> [a]
- taylor0 :: Fractional a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> a -> [a]
- maclaurin :: Fractional a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> [a]
- maclaurin0 :: Fractional a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> [a]
- diff :: Num a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> a
- diff' :: Num a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> (a, a)
- diffs :: Num a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> [a]
- diffs0 :: Num a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> [a]
- diffsF :: (Functor f, Num a) => (forall s. AD s (Tower a) -> f (AD s (Tower a))) -> a -> f [a]
- diffs0F :: (Functor f, Num a) => (forall s. AD s (Tower a) -> f (AD s (Tower a))) -> a -> f [a]
- du :: (Functor f, Num a) => (forall s. f (AD s (Tower a)) -> AD s (Tower a)) -> f (a, a) -> a
- du' :: (Functor f, Num a) => (forall s. f (AD s (Tower a)) -> AD s (Tower a)) -> f (a, a) -> (a, a)
- dus :: (Functor f, Num a) => (forall s. f (AD s (Tower a)) -> AD s (Tower a)) -> f [a] -> [a]
- dus0 :: (Functor f, Num a) => (forall s. f (AD s (Tower a)) -> AD s (Tower a)) -> f [a] -> [a]
- duF :: (Functor f, Functor g, Num a) => (forall s. f (AD s (Tower a)) -> g (AD s (Tower a))) -> f (a, a) -> g a
- duF' :: (Functor f, Functor g, Num a) => (forall s. f (AD s (Tower a)) -> g (AD s (Tower a))) -> f (a, a) -> g (a, a)
- dusF :: (Functor f, Functor g, Num a) => (forall s. f (AD s (Tower a)) -> g (AD s (Tower a))) -> f [a] -> g [a]
- dus0F :: (Functor f, Functor g, Num a) => (forall s. f (AD s (Tower a)) -> g (AD s (Tower a))) -> f [a] -> g [a]

# Documentation

## Instances

`Tower`

is an AD `Mode`

that calculates a tangent tower by forward AD, and provides fast `diffsUU`

, `diffsUF`

## Instances

(Num a, Bounded a) => Bounded (Tower a) Source # | |

(Num a, Enum a) => Enum (Tower a) Source # | |

(Num a, Eq a) => Eq (Tower a) Source # | |

Floating a => Floating (Tower a) Source # | |

Fractional a => Fractional (Tower a) Source # | |

Data a => Data (Tower a) Source # | |

Defined in Numeric.AD.Internal.Tower gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Tower a -> c (Tower a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Tower a) # toConstr :: Tower a -> Constr # dataTypeOf :: Tower a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Tower a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Tower a)) # gmapT :: (forall b. Data b => b -> b) -> Tower a -> Tower a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Tower a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Tower a -> r # gmapQ :: (forall d. Data d => d -> u) -> Tower a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Tower a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Tower a -> m (Tower a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Tower a -> m (Tower a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Tower a -> m (Tower a) # | |

Num a => Num (Tower a) Source # | |

(Num a, Ord a) => Ord (Tower a) Source # | |

Real a => Real (Tower a) Source # | |

Defined in Numeric.AD.Internal.Tower toRational :: Tower a -> Rational # | |

RealFloat a => RealFloat (Tower a) Source # | |

Defined in Numeric.AD.Internal.Tower floatRadix :: Tower a -> Integer # floatDigits :: Tower a -> Int # floatRange :: Tower a -> (Int, Int) # decodeFloat :: Tower a -> (Integer, Int) # encodeFloat :: Integer -> Int -> Tower a # significand :: Tower a -> Tower a # scaleFloat :: Int -> Tower a -> Tower a # isInfinite :: Tower a -> Bool # isDenormalized :: Tower a -> Bool # isNegativeZero :: Tower a -> Bool # | |

RealFrac a => RealFrac (Tower a) Source # | |

Show a => Show (Tower a) Source # | |

Erf a => Erf (Tower a) Source # | |

InvErf a => InvErf (Tower a) Source # | |

Num a => Mode (Tower a) Source # | |

Defined in Numeric.AD.Internal.Tower | |

Num a => Jacobian (Tower a) Source # | |

Defined in Numeric.AD.Internal.Tower unary :: (Scalar (Tower a) -> Scalar (Tower a)) -> D (Tower a) -> Tower a -> Tower a Source # lift1 :: (Scalar (Tower a) -> Scalar (Tower a)) -> (D (Tower a) -> D (Tower a)) -> Tower a -> Tower a Source # lift1_ :: (Scalar (Tower a) -> Scalar (Tower a)) -> (D (Tower a) -> D (Tower a) -> D (Tower a)) -> Tower a -> Tower a Source # binary :: (Scalar (Tower a) -> Scalar (Tower a) -> Scalar (Tower a)) -> D (Tower a) -> D (Tower a) -> Tower a -> Tower a -> Tower a Source # lift2 :: (Scalar (Tower a) -> Scalar (Tower a) -> Scalar (Tower a)) -> (D (Tower a) -> D (Tower a) -> (D (Tower a), D (Tower a))) -> Tower a -> Tower a -> Tower a Source # lift2_ :: (Scalar (Tower a) -> Scalar (Tower a) -> Scalar (Tower a)) -> (D (Tower a) -> D (Tower a) -> D (Tower a) -> (D (Tower a), D (Tower a))) -> Tower a -> Tower a -> Tower a Source # | |

type Scalar (Tower a) Source # | |

Defined in Numeric.AD.Internal.Tower | |

type D (Tower a) Source # | |

Defined in Numeric.AD.Internal.Tower |

# Taylor Series

# Maclaurin Series

maclaurin0 :: Fractional a => (forall s. AD s (Tower a) -> AD s (Tower a)) -> a -> [a] Source #

# Derivatives

diffsF :: (Functor f, Num a) => (forall s. AD s (Tower a) -> f (AD s (Tower a))) -> a -> f [a] Source #

diffs0F :: (Functor f, Num a) => (forall s. AD s (Tower a) -> f (AD s (Tower a))) -> a -> f [a] Source #

# Directional Derivatives

du :: (Functor f, Num a) => (forall s. f (AD s (Tower a)) -> AD s (Tower a)) -> f (a, a) -> a Source #

du' :: (Functor f, Num a) => (forall s. f (AD s (Tower a)) -> AD s (Tower a)) -> f (a, a) -> (a, a) Source #

dus :: (Functor f, Num a) => (forall s. f (AD s (Tower a)) -> AD s (Tower a)) -> f [a] -> [a] Source #

dus0 :: (Functor f, Num a) => (forall s. f (AD s (Tower a)) -> AD s (Tower a)) -> f [a] -> [a] Source #

duF :: (Functor f, Functor g, Num a) => (forall s. f (AD s (Tower a)) -> g (AD s (Tower a))) -> f (a, a) -> g a Source #

duF' :: (Functor f, Functor g, Num a) => (forall s. f (AD s (Tower a)) -> g (AD s (Tower a))) -> f (a, a) -> g (a, a) Source #