Synopsis

# Documentation

newtype Index Source

Constructors

 Index (IntMap Int)

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

Constructors

 Sparse a (IntMap (Sparse a))

Instances

 Typeable1 Sparse Lifted Sparse => Jacobian Sparse Primal Sparse Lifted Sparse => Mode Sparse Lifted Sparse Data a => Data (Sparse a) Show a => Show (Sparse a) Num a => Grad (AD Sparse a) [a] (a, [a]) a Grads i o a => Grads (AD Sparse a -> i) (a -> o) a Num a => Grads (AD Sparse a) (Stream [] a) a Grad i o o' a => Grad (AD Sparse a -> i) (a -> o) (a -> o') a

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

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

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

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

ds :: (Traversable f, Num a) => f b -> AD Sparse a -> Stream f aSource

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

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

partial :: Num a => [Int] -> Sparse a -> 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 -> [AD Sparse a] -> AD Sparse aSource

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

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

Instances

 Num a => Grad (AD Sparse a) [a] (a, [a]) a Grad i o o' a => Grad (AD 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 -> [AD Sparse a] -> AD Sparse aSource

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

Instances

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