@@ -150,29 +150,31 @@ function pdmp(∇ϕ!, t0, x0, θ0, T, c::Bound, Flow::Union{BouncyParticle, Boom
150
150
end
151
151
152
152
153
- function pdmp_inner! (rng, dϕ, ∇ϕ!, ∇ϕx, t, x, θ, c:: Bound , abc, (t′, renew), τref, v, (acc, num),
154
- Flow:: BouncyParticle , args... ; subsample= false , oscn= false , factor= 1.5 , adapt= false )
153
+ # #################################
154
+
155
+ function pdmp_inner! (rng, dϕ:: F1 , ∇ϕ!:: F2 , ∇ϕx, t, x, θ, c:: Bound , abc, (t′, renew), τref, (acc, num),
156
+ Flow:: BouncyParticle , args... ; subsample= false , oscn= false , factor= 1.5 , adapt= false ) where {F1, F2}
155
157
while true
156
158
if τref < t′
157
- t, x, θ = move_forward! (τref - t, t, x, θ, Flow)
159
+ t, _ = move_forward! (τref - t, t, x, θ, Flow)
158
160
refresh! (rng, θ, Flow)
159
161
θdϕ, v = dϕ (t, x, θ, args... )
160
162
# ∇ϕx = grad_correct!(∇ϕx, x, Flow)
161
163
l = λ (θdϕ, Flow)
162
164
τref = t + waiting_time_ref (rng, Flow)
163
165
abc = ab (x, θ, c, θdϕ, v, Flow)
164
166
t′, renew = next_time (t, abc, rand (rng))
165
- return t, x, θ, (acc, num), c, abc, (t′, renew), τref, v
167
+ return t, (acc, num), c, abc, (t′, renew), τref
166
168
elseif renew
167
169
τ = t′ - t
168
- t, x, θ = move_forward! (τ, t, x, θ, Flow)
170
+ t, _ = move_forward! (τ, t, x, θ, Flow)
169
171
θdϕ, v = dϕ (t, x, θ, args... )
170
172
# ∇ϕx = grad_correct!(∇ϕx, x, Flow)
171
173
abc = ab (x, θ, c, θdϕ, v, Flow)
172
174
t′, renew = next_time (t, abc, rand (rng))
173
175
else
174
176
τ = t′ - t
175
- t, x, θ = move_forward! (τ, t, x, θ, Flow)
177
+ t, _ = move_forward! (τ, t, x, θ, Flow)
176
178
θdϕ, v = dϕ (t, x, θ, args... )
177
179
# ∇ϕx = grad_correct!(∇ϕx, x, Flow)
178
180
l, lb = λ (θdϕ, Flow), pos (abc[1 ] + abc[2 ]* τ)
@@ -189,13 +191,13 @@ function pdmp_inner!(rng, dϕ, ∇ϕ!, ∇ϕx, t, x, θ, c::Bound, abc, (t′, r
189
191
@assert Flow. L == I
190
192
oscn! (rng, θ, ∇ϕx, Flow. ρ; normalize= false )
191
193
else
192
- θ = reflect! (∇ϕx, x, θ, Flow)
194
+ reflect! (∇ϕx, x, θ, Flow)
193
195
end
194
196
θdϕ, v = dϕ (t, x, θ, args... )
195
197
# ∇ϕx = grad_correct!(∇ϕx, x, Flow)
196
198
abc = ab (x, θ, c, θdϕ, v, Flow)
197
199
t′, renew = next_time (t, abc, rand (rng))
198
- ! subsample && return t, x, θ, (acc, num), c, abc, (t′, renew), τref, v
200
+ ! subsample && return t, (acc, num), c, abc, (t′, renew), τref
199
201
else
200
202
abc = ab (x, θ, c, θdϕ, v, Flow)
201
203
t′, renew = next_time (t, abc, rand (rng))
@@ -204,7 +206,6 @@ function pdmp_inner!(rng, dϕ, ∇ϕ!, ∇ϕx, t, x, θ, c::Bound, abc, (t′, r
204
206
end
205
207
end
206
208
"""
207
-
208
209
pdmp(dϕ, ∇ϕ!, t0, x0, θ0, T, c::Bound, Flow::BouncyParticle, args...; oscn=false, adapt=false, subsample=false, progress=false, progress_stops = 20, islocal = false, seed=Seed(), factor=2.0)
209
210
210
211
The first directional derivative `dϕ[1]` tells me if I move up or down the potential. The second directional derivative `dϕ[2]` tells me how fast the first changes. The gradient `∇ϕ!` tells me the surface I want to reflect on.
@@ -275,7 +276,7 @@ function pdmp(dϕ, ∇ϕ!, t0, x0, θ0, T, c::Bound, Flow::BouncyParticle, args.
275
276
276
277
t′, renew = next_time (t, abc, rand (rng))
277
278
while t < T
278
- t, x, θ, (acc, num), c, abc, (t′, renew), τref, v = pdmp_inner! (rng, dϕ, ∇ϕ!, ∇ϕx, t, x, θ, c, abc, (t′, renew), τref, v , (acc, num), Flow, args... ; oscn= oscn, subsample= subsample, factor= factor, adapt= adapt)
279
+ t, (acc, num), c, abc, (t′, renew), τref = pdmp_inner! (rng, dϕ, ∇ϕ!, ∇ϕx, t, x, θ, c, abc, (t′, renew), τref, (acc, num), Flow, args... ; oscn= oscn, subsample= subsample, factor= factor, adapt= adapt)
279
280
push! (Ξ, event (t, x, θ, Flow))
280
281
281
282
if t > tstop
0 commit comments