[ANN] ZigZagBoomerang.jl

Here is a MWE. I would want x[2] to always be positive. Thanks again.

using ZigZagBoomerang, Distributions, ForwardDiff, LinearAlgebra, SparseArrays

data = rand(Normal(3,10),20)
g(x) =sum(logpdf.(Normal(x[1],x[2]),data))

function ∇ϕ(x, i) 
   d = -ForwardDiff.gradient(g,x)
   d[i]
end
n= 2
t0 = 0.0
x0 = abs.(randn(n))
θ0 = rand([-1.0,1.0], n)
c = 1.0*ones(length(x0))
Z = ZigZag(sparse(I(n)), x0*0);
T = 200.0

trace, (tT, xT, θT), (acc, num) = pdmp(∇ϕ, t0, x0, θ0, T, c, Z; adapt=true)

  • List item