| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Boltzmann.Species
Description
Applicative interface to define recursive structures and derive Boltzmann samplers.
Given the recursive structure of the types, and how to combine generators, the library takes care of computing the oracles and setting the right distributions.
Synopsis
- class Embed f m where
- class (Alternative f, Num (Scalar f)) => Module f where
- type Endo a = a -> a
- data System f a c = System {}
- sys :: System f a c -> f () -> Vector (f a) -> Vector (f a)
- newtype ConstModule r a = ConstModule {
- unConstModule :: r
- solve :: forall b c. (forall a. Num a => System (ConstModule a) b c) -> Double -> Maybe (Vector Double)
- sizedGenerator :: forall b c m. MonadRandomLike m => (forall f. (Module f, Embed f m) => System (Pointiful f) b c) -> Int -> Int -> Maybe Double -> m b
- solveSized :: forall b c. (forall a. Num a => System (Pointiful (ConstModule a)) b c) -> Int -> Int -> Maybe Double -> (Double, Vector Double)
- newtype Weighted m a = Weighted [(Double, m a)]
- weighted :: Double -> m a -> Weighted m a
- runWeighted :: MonadRandomLike m => Weighted m a -> (Double, m a)
- sfix :: MonadRandomLike m => System (Weighted m) b c -> Double -> Vector Double -> (Vector (m b), c)
- data Pointiful f a
- unPointiful :: Alternative f => Pointiful f a -> [f a]
- point :: Module f => Int -> System (Pointiful f) b c -> System f b c
Documentation
Instances
| Embed f m => Embed (Pointiful f) m # | |
| MonadRandomLike m => Embed (Weighted m) m # | |
| Num r => Embed (ConstModule r) m # | |
Defined in Boltzmann.Species Methods emap :: (m a -> m b) -> ConstModule r a -> ConstModule r b # embed :: m a -> ConstModule r a # | |
class (Alternative f, Num (Scalar f)) => Module f where #
Applicative defines a product, Alternative defines an addition,
with scalar multiplication we get a module.
This typeclass allows to directly tweak weights in the oracle by chosen factors.
Minimal complete definition
Nothing
Instances
| Module f => Module (Pointiful f) # | |
| MonadRandomLike m => Module (Weighted m) # | |
| Num r => Module (ConstModule r) # | |
Defined in Boltzmann.Species Associated Types type Scalar (ConstModule r) :: Type # Methods scalar :: Scalar (ConstModule r) -> ConstModule r () # (<.>) :: Scalar (ConstModule r) -> ConstModule r a -> ConstModule r a # | |
newtype ConstModule r a #
Constructors
| ConstModule | |
Fields
| |
Instances
solve :: forall b c. (forall a. Num a => System (ConstModule a) b c) -> Double -> Maybe (Vector Double) #
Instances
| Functor m => Functor (Weighted m) # | |
| MonadRandomLike m => Applicative (Weighted m) # | |
Defined in Boltzmann.Species | |
| MonadRandomLike m => Alternative (Weighted m) # | |
| MonadRandomLike m => Module (Weighted m) # | |
| MonadRandomLike m => Embed (Weighted m) m # | |
| type Scalar (Weighted m) # | |
Defined in Boltzmann.Species | |
runWeighted :: MonadRandomLike m => Weighted m a -> (Double, m a) #
sfix :: MonadRandomLike m => System (Weighted m) b c -> Double -> Vector Double -> (Vector (m b), c) #
unPointiful :: Alternative f => Pointiful f a -> [f a] #