ad-4.3.2.1: Automatic Differentiation

Copyright(c) Edward Kmett 2010-2015
LicenseBSD3
Maintainerekmett@gmail.com
Stabilityexperimental
PortabilityGHC only
Safe HaskellNone
LanguageHaskell2010

Numeric.AD.Rank1.Tower

Contents

Description

Higher order derivatives via a "dual number tower".

Synopsis

Documentation

data Tower a Source #

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) # 

Methods

minBound :: Tower a #

maxBound :: Tower a #

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

Methods

succ :: Tower a -> Tower a #

pred :: Tower a -> Tower a #

toEnum :: Int -> Tower a #

fromEnum :: Tower a -> Int #

enumFrom :: Tower a -> [Tower a] #

enumFromThen :: Tower a -> Tower a -> [Tower a] #

enumFromTo :: Tower a -> Tower a -> [Tower a] #

enumFromThenTo :: Tower a -> Tower a -> Tower a -> [Tower a] #

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

Methods

(==) :: Tower a -> Tower a -> Bool #

(/=) :: Tower a -> Tower a -> Bool #

Floating a => Floating (Tower a) # 

Methods

pi :: Tower a #

exp :: Tower a -> Tower a #

log :: Tower a -> Tower a #

sqrt :: Tower a -> Tower a #

(**) :: Tower a -> Tower a -> Tower a #

logBase :: Tower a -> Tower a -> Tower a #

sin :: Tower a -> Tower a #

cos :: Tower a -> Tower a #

tan :: Tower a -> Tower a #

asin :: Tower a -> Tower a #

acos :: Tower a -> Tower a #

atan :: Tower a -> Tower a #

sinh :: Tower a -> Tower a #

cosh :: Tower a -> Tower a #

tanh :: Tower a -> Tower a #

asinh :: Tower a -> Tower a #

acosh :: Tower a -> Tower a #

atanh :: Tower a -> Tower a #

log1p :: Tower a -> Tower a #

expm1 :: Tower a -> Tower a #

log1pexp :: Tower a -> Tower a #

log1mexp :: Tower a -> Tower a #

Fractional a => Fractional (Tower a) # 

Methods

(/) :: Tower a -> Tower a -> Tower a #

recip :: Tower a -> Tower a #

fromRational :: Rational -> Tower a #

Data a => Data (Tower a) Source # 

Methods

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) # 

Methods

(+) :: Tower a -> Tower a -> Tower a #

(-) :: Tower a -> Tower a -> Tower a #

(*) :: Tower a -> Tower a -> Tower a #

negate :: Tower a -> Tower a #

abs :: Tower a -> Tower a #

signum :: Tower a -> Tower a #

fromInteger :: Integer -> Tower a #

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

Methods

compare :: Tower a -> Tower a -> Ordering #

(<) :: Tower a -> Tower a -> Bool #

(<=) :: Tower a -> Tower a -> Bool #

(>) :: Tower a -> Tower a -> Bool #

(>=) :: Tower a -> Tower a -> Bool #

max :: Tower a -> Tower a -> Tower a #

min :: Tower a -> Tower a -> Tower a #

Real a => Real (Tower a) # 

Methods

toRational :: Tower a -> Rational #

RealFloat a => RealFloat (Tower a) # 
RealFrac a => RealFrac (Tower a) # 

Methods

properFraction :: Integral b => Tower a -> (b, Tower a) #

truncate :: Integral b => Tower a -> b #

round :: Integral b => Tower a -> b #

ceiling :: Integral b => Tower a -> b #

floor :: Integral b => Tower a -> b #

Show a => Show (Tower a) Source # 

Methods

showsPrec :: Int -> Tower a -> ShowS #

show :: Tower a -> String #

showList :: [Tower a] -> ShowS #

Erf a => Erf (Tower a) # 

Methods

erf :: Tower a -> Tower a #

erfc :: Tower a -> Tower a #

erfcx :: Tower a -> Tower a #

normcdf :: Tower a -> Tower a #

InvErf a => InvErf (Tower a) # 

Methods

inverf :: Tower a -> Tower a #

inverfc :: Tower a -> Tower a #

invnormcdf :: Tower a -> Tower a #

Num a => Mode (Tower a) Source # 

Associated Types

type Scalar (Tower a) :: * Source #

Num a => Jacobian (Tower a) Source # 

Associated Types

type D (Tower a) :: * Source #

Methods

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 # 
type Scalar (Tower a) = a
type D (Tower a) Source # 
type D (Tower a) = Tower a

auto :: Mode t => Scalar t -> t Source #

Embed a constant

Taylor Series

taylor :: Fractional a => (Tower a -> Tower a) -> a -> a -> [a] Source #

taylor f x compute the Taylor series of f around x.

taylor0 :: Fractional a => (Tower a -> Tower a) -> a -> a -> [a] Source #

taylor0 f x compute the Taylor series of f around x, zero-padded.

Maclaurin Series

maclaurin :: Fractional a => (Tower a -> Tower a) -> a -> [a] Source #

maclaurin f compute the Maclaurin series of f

maclaurin0 :: Fractional a => (Tower a -> Tower a) -> a -> [a] Source #

maclaurin f compute the Maclaurin series of f, zero-padded

Derivatives

diff :: Num a => (Tower a -> Tower a) -> a -> a Source #

Compute the first derivative of a function (a -> a)

diff' :: Num a => (Tower a -> Tower a) -> a -> (a, a) Source #

Compute the answer and first derivative of a function (a -> a)

diffs :: Num a => (Tower a -> Tower a) -> a -> [a] Source #

Compute the answer and all derivatives of a function (a -> a)

diffs0 :: Num a => (Tower a -> Tower a) -> a -> [a] Source #

Compute the zero-padded derivatives of a function (a -> a)

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

Compute the answer and all derivatives of a function (a -> f a)

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

Compute the zero-padded derivatives of a function (a -> f a)

Directional Derivatives

du :: (Functor f, Num a) => (f (Tower a) -> Tower a) -> f (a, a) -> a Source #

Compute a directional derivative of a function (f a -> a)

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

Compute the answer and a directional derivative of a function (f a -> a)

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

Given a function (f a -> a), and a tower of derivatives, compute the corresponding directional derivatives.

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

Given a function (f a -> a), and a tower of derivatives, compute the corresponding directional derivatives, zero-padded

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

Compute a directional derivative of a function (f a -> g a)

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

Compute the answer and a directional derivative of a function (f a -> g a)

dusF :: (Functor f, Functor g, Num a) => (f (Tower a) -> g (Tower a)) -> f [a] -> g [a] Source #

Given a function (f a -> g a), and a tower of derivatives, compute the corresponding directional derivatives

dus0F :: (Functor f, Functor g, Num a) => (f (Tower a) -> g (Tower a)) -> f [a] -> g [a] Source #

Given a function (f a -> g a), and a tower of derivatives, compute the corresponding directional derivatives, zero-padded