ad-4.0.0.1: Automatic Differentiation

Safe HaskellNone

Numeric.AD.Internal.Sparse

Synopsis

Documentation

newtype Index Source

Constructors

Index (IntMap Int) 

data Sparse a s 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 distinct nth partial derivatives of a function with k inputs.

Constructors

Sparse !a (IntMap (Sparse a s)) 
Zero 

Instances

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

apply :: (Traversable f, Num a) => (f (Sparse a s) -> b) -> f a -> bSource

vars :: (Traversable f, Num a) => f a -> f (Sparse a s)Source

d :: (Traversable f, Num a) => f b -> Sparse a s -> f aSource

d' :: (Traversable f, Num a) => f a -> Sparse a s -> (a, f a)Source

ds :: (Traversable f, Num a) => f b -> Sparse a s -> Cofree f aSource

skeleton :: Traversable f => f a -> f IntSource

spartial :: Num a => [Int] -> Sparse a s -> Maybe aSource

partial :: Num a => [Int] -> Sparse a s -> aSource

vgrad :: Grad i o o' a => i -> oSource

vgrad' :: Grad i o o' a => i -> o'Source

vgrads :: Grads i o a => i -> oSource

class Num a => Grad i o o' a | i -> a o o', o -> a i o', o' -> a i o whereSource

Methods

pack :: i -> [Sparse a ()] -> Sparse a ()Source

unpack :: ([a] -> [a]) -> oSource

unpack' :: ([a] -> (a, [a])) -> o'Source

Instances

Num a => Grad (Sparse a ()) [a] (a, [a]) a 
Grad i o o' a => Grad (Sparse a () -> i) (a -> o) (a -> o') a 

class Num a => Grads i o a | i -> a o, o -> a i whereSource

Methods

packs :: i -> [Sparse a ()] -> Sparse a ()Source

unpacks :: ([a] -> Cofree [] a) -> oSource

Instances

Grads i o a => Grads (Sparse a () -> i) (a -> o) a 
Num a => Grads (Sparse a ()) (Cofree [] a) a