Copyright | (c) Edward Kmett 2010-2021 |
---|---|
License | BSD3 |
Maintainer | ekmett@gmail.com |
Stability | experimental |
Portability | GHC only |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Unsafe and often partial combinators intended for internal usage.
Handle with care.
Synopsis
- newtype Monomial = Monomial (IntMap Int)
- emptyMonomial :: Monomial
- addToMonomial :: Int -> Monomial -> Monomial
- indices :: Monomial -> [Int]
- data Sparse a
- apply :: (Traversable f, Num a) => (f (Sparse a) -> b) -> f a -> b
- vars :: (Traversable f, Num a) => f a -> f (Sparse a)
- d :: (Traversable f, Num a) => f b -> Sparse a -> f a
- d' :: (Traversable f, Num a) => f a -> Sparse a -> (a, f a)
- ds :: (Traversable f, Num a) => f b -> Sparse a -> Cofree f a
- skeleton :: Traversable f => f a -> f Int
- spartial :: Num a => [Int] -> Sparse a -> Maybe a
- partial :: Num a => [Int] -> Sparse a -> a
- vgrad :: Grad i o o' a => i -> o
- vgrad' :: Grad i o o' a => i -> o'
- vgrads :: Grads i o a => i -> o
- class Num a => Grad i o o' a | i -> a o o', o -> a i o', o' -> a i o where
- class Num a => Grads i o a | i -> a o, o -> a i where
- terms :: Monomial -> [(Integer, Monomial, Monomial)]
- primal :: Num a => Sparse a -> a
Documentation
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.
Instances
skeleton :: Traversable f => f a -> f Int Source #
class Num a => Grad i o o' a | i -> a o o', o -> a i o', o' -> a i o where Source #