ad-4.3: Automatic Differentiation

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

Numeric.AD.Mode.Sparse

Contents

Description

Higher order derivatives via a "dual number tower".

Synopsis

Documentation

data AD s a Source

Instances

Bounded a => Bounded (AD s a) Source 
Enum a => Enum (AD s a) Source 
Eq a => Eq (AD s a) Source 
Floating a => Floating (AD s a) Source 
Fractional a => Fractional (AD s a) Source 
Num a => Num (AD s a) Source 
Ord a => Ord (AD s a) Source 
Read a => Read (AD s a) Source 
Real a => Real (AD s a) Source 
RealFloat a => RealFloat (AD s a) Source 
RealFrac a => RealFrac (AD s a) Source 
Show a => Show (AD s a) Source 
Erf a => Erf (AD s a) Source 
InvErf a => InvErf (AD s a) Source 
Mode a => Mode (AD s a) Source 
type Scalar (AD s a) = Scalar a Source 

data Sparse a Source

We only store partials in sorted order, so the map contained in a partial will only contain partials with equal or greater keys to that of the map in which it was found. This should be key for efficiently computing sparse hessians. there are only (n + k - 1) choose (k - 1) distinct nth partial derivatives of a function with k inputs.

Instances

(Num a, Bounded a) => Bounded (Sparse a) 
(Num a, Enum a) => Enum (Sparse a) 
(Num a, Eq a) => Eq (Sparse a) 
Floating a => Floating (Sparse a) 
Fractional a => Fractional (Sparse a) 
Data a => Data (Sparse a) Source 
Num a => Num (Sparse a) 
(Num a, Ord a) => Ord (Sparse a) 
Real a => Real (Sparse a) 
RealFloat a => RealFloat (Sparse a) 
RealFrac a => RealFrac (Sparse a) 
Show a => Show (Sparse a) Source 
Erf a => Erf (Sparse a) 
InvErf a => InvErf (Sparse a) 
Num a => Mode (Sparse a) Source 
Num a => Jacobian (Sparse a) Source 
Num a => Grad (Sparse a) [a] (a, [a]) a Source 
Num a => Grads (Sparse a) (Cofree [] a) a Source 
Grads i o a => Grads (Sparse a -> i) (a -> o) a Source 
Grad i o o' a => Grad (Sparse a -> i) (a -> o) (a -> o') a Source 
type Scalar (Sparse a) = a Source 
type D (Sparse a) = Sparse a Source 

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

Embed a constant

Sparse Gradients

grad :: (Traversable f, Num a) => (forall s. f (AD s (Sparse a)) -> AD s (Sparse a)) -> f a -> f a Source

grad' :: (Traversable f, Num a) => (forall s. f (AD s (Sparse a)) -> AD s (Sparse a)) -> f a -> (a, f a) Source

grads :: (Traversable f, Num a) => (forall s. f (AD s (Sparse a)) -> AD s (Sparse a)) -> f a -> Cofree f a Source

gradWith :: (Traversable f, Num a) => (a -> a -> b) -> (forall s. f (AD s (Sparse a)) -> AD s (Sparse a)) -> f a -> f b Source

gradWith' :: (Traversable f, Num a) => (a -> a -> b) -> (forall s. f (AD s (Sparse a)) -> AD s (Sparse a)) -> f a -> (a, f b) Source

Sparse Jacobians (synonyms)

jacobian :: (Traversable f, Functor g, Num a) => (forall s. f (AD s (Sparse a)) -> g (AD s (Sparse a))) -> f a -> g (f a) Source

jacobian' :: (Traversable f, Functor g, Num a) => (forall s. f (AD s (Sparse a)) -> g (AD s (Sparse a))) -> f a -> g (a, f a) Source

jacobianWith :: (Traversable f, Functor g, Num a) => (a -> a -> b) -> (forall s. f (AD s (Sparse a)) -> g (AD s (Sparse a))) -> f a -> g (f b) Source

jacobianWith' :: (Traversable f, Functor g, Num a) => (a -> a -> b) -> (forall s. f (AD s (Sparse a)) -> g (AD s (Sparse a))) -> f a -> g (a, f b) Source

jacobians :: (Traversable f, Functor g, Num a) => (forall s. f (AD s (Sparse a)) -> g (AD s (Sparse a))) -> f a -> g (Cofree f a) Source

Sparse Hessians

hessian :: (Traversable f, Num a) => (forall s. f (AD s (Sparse a)) -> AD s (Sparse a)) -> f a -> f (f a) Source

hessian' :: (Traversable f, Num a) => (forall s. f (AD s (Sparse a)) -> AD s (Sparse a)) -> f a -> (a, f (a, f a)) Source

hessianF :: (Traversable f, Functor g, Num a) => (forall s. f (AD s (Sparse a)) -> g (AD s (Sparse a))) -> f a -> g (f (f a)) Source

hessianF' :: (Traversable f, Functor g, Num a) => (forall s. f (AD s (Sparse a)) -> g (AD s (Sparse a))) -> f a -> g (a, f (a, f a)) Source