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

License | BSD3 |

Maintainer | ekmett@gmail.com |

Stability | experimental |

Portability | GHC only |

Safe Haskell | None |

Language | Haskell2010 |

Dense Forward AD. Useful when the result involves the majority of the input
elements. Do not use for `hessian`

and beyond, since
they only contain a small number of unique `n`

th derivatives --
`(n + k - 1) `

for functions of `choose`

k`k`

inputs rather than the
`k^n`

that would be generated by using `Dense`

, not to mention the redundant
intermediate derivatives that would be
calculated over and over during that process!

Assumes all instances of `f`

have the same number of elements.

NB: We don't need the full power of `Traversable`

here, we could get
by with a notion of zippable that can plug in 0's for the missing
entries. This might allow for gradients where `f`

has exponentials like `((->) a)`

# Documentation

(Traversable f, Num a, Bounded a) => Bounded (Dense f a) | |

(Traversable f, Num a, Enum a) => Enum (Dense f a) | |

(Traversable f, Num a, Eq a) => Eq (Dense f a) | |

(Traversable f, Floating a) => Floating (Dense f a) | |

(Traversable f, Fractional a) => Fractional (Dense f a) | |

(Traversable f, Num a) => Num (Dense f a) | |

(Traversable f, Num a, Ord a) => Ord (Dense f a) | |

(Traversable f, Real a) => Real (Dense f a) | |

(Traversable f, RealFloat a) => RealFloat (Dense f a) | |

(Traversable f, RealFrac a) => RealFrac (Dense f a) | |

Show a => Show (Dense f a) | |

(Traversable f, Erf a) => Erf (Dense f a) | |

(Traversable f, InvErf a) => InvErf (Dense f a) | |

(Num a, Traversable f) => Mode (Dense f a) | |

(Traversable f, Num a) => Jacobian (Dense f a) | |

type Scalar (Dense f a) = a | |

type D (Dense f a) = Id a |

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

apply :: (Traversable f, Num a) => (f (Dense f a) -> b) -> f a -> b Source