| 1 |
module MCMC.Moves.Integer where |
| 2 |
|
| 3 |
import Range |
| 4 |
import MCMC.Types |
| 5 |
|
| 6 |
-- Transition kernel: Perform gibbs sampling on modifiable x, which takes values [0..n-1], in context c |
| 7 |
foreign import bpcall "MCMC:" gibbsSampleCategoricalRaw :: Modifiable Int -> Int -> ContextIndex -> IO () |
| 8 |
gibbsSampleCategorical i n = TransitionKernel (gibbsSampleCategoricalRaw i n) |
| 9 |
|
| 10 |
foreign import bpcall "MCMC:" discreteUniformAvoidMHRaw :: Modifiable Int -> Int -> Int -> ContextIndex -> IO () |
| 11 |
discreteUniformAvoidMH i l u = TransitionKernel (discreteUniformAvoidMHRaw i l u) |
| 12 |
|
| 13 |
-- It would be nice if we could (i) seq x and bounds HERE, and (ii) convert range to bounds HERE. |
| 14 |
-- But the seq needs to be done during changeable execution, and we execute the IO unchangeably. |
| 15 |
foreign import bpcall "MCMC:" incDecMHRaw :: Modifiable Int -> BuiltinBounds -> ContextIndex -> IO () |
| 16 |
incDecMH x bnds = TransitionKernel $ incDecMHRaw x (c_range bnds) |
| 17 |
|
| 18 |
foreign import bpcall "MCMC:" sliceSampleIntegerRaw :: Modifiable Int -> BuiltinBounds -> ContextIndex -> IO () |
| 19 |
sliceSampleInteger x bnds = TransitionKernel $ sliceSampleIntegerRaw x (c_range bnds) |
| 20 |
|