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 SparseDouble
- = Sparse !Double (IntMap SparseDouble)
- | Zero
- apply :: Traversable f => (f SparseDouble -> b) -> f Double -> b
- vars :: Traversable f => f Double -> f SparseDouble
- d :: Traversable f => f b -> SparseDouble -> f Double
- d' :: Traversable f => f Double -> SparseDouble -> (Double, f Double)
- ds :: Traversable f => f b -> SparseDouble -> Cofree f Double
- skeleton :: Traversable f => f a -> f Int
- spartial :: [Int] -> SparseDouble -> Maybe Double
- partial :: [Int] -> SparseDouble -> Double
- vgrad :: Grad i o o' => i -> o
- vgrad' :: Grad i o o' => i -> o'
- vgrads :: Grads i o => i -> o
- class Grad i o o' | i -> o o', o -> i o', o' -> i o where
- pack :: i -> [SparseDouble] -> SparseDouble
- unpack :: ([Double] -> [Double]) -> o
- unpack' :: ([Double] -> (Double, [Double])) -> o'
- class Grads i o | i -> o, o -> i where
- packs :: i -> [SparseDouble] -> SparseDouble
- unpacks :: ([Double] -> Cofree List Double) -> o
- terms :: Monomial -> [(Integer, Monomial, Monomial)]
- primal :: SparseDouble -> Double
Documentation
data SparseDouble 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.
Instances
apply :: Traversable f => (f SparseDouble -> b) -> f Double -> b Source #
vars :: Traversable f => f Double -> f SparseDouble Source #
d :: Traversable f => f b -> SparseDouble -> f Double Source #
d' :: Traversable f => f Double -> SparseDouble -> (Double, f Double) Source #
ds :: Traversable f => f b -> SparseDouble -> Cofree f Double Source #
skeleton :: Traversable f => f a -> f Int Source #
class Grad i o o' | i -> o o', o -> i o', o' -> i o where Source #
pack :: i -> [SparseDouble] -> SparseDouble Source #
Instances
Grad SparseDouble [Double] (Double, [Double]) Source # | |
Grad i o o' => Grad (SparseDouble -> i) (Double -> o) (Double -> o') Source # | |
Defined in Numeric.AD.Internal.Sparse.Double |
class Grads i o | i -> o, o -> i where Source #
packs :: i -> [SparseDouble] -> SparseDouble Source #
Instances
Grads SparseDouble (Cofree List Double) Source # | |
Defined in Numeric.AD.Internal.Sparse.Double | |
Grads i o => Grads (SparseDouble -> i) (Double -> o) Source # | |
Defined in Numeric.AD.Internal.Sparse.Double packs :: (SparseDouble -> i) -> [SparseDouble] -> SparseDouble Source # unpacks :: ([Double] -> Cofree List Double) -> Double -> o Source # |
primal :: SparseDouble -> Double Source #