@@ -53,15 +53,15 @@ include(dir*"/test/test_utils/AllUtils.jl")
53
53
@test pc. logWs == logps
54
54
@test getweights (pc) ≈ exp .(logps) ./ sum (exp, logps)
55
55
@test all (getweight (pc, i) ≈ exp (logps[i]) / sum (exp, logps) for i in 1 : 3 )
56
- @test logZ (pc) == log (sum (exp, logps))
56
+ @test logZ (pc) ≈ log (sum (exp, logps))
57
57
58
58
# Reweight particles.
59
59
reweight! (pc)
60
60
@test all (iszero (getlogp (particle. vi)) for particle in pc. vals)
61
61
@test pc. logWs == 2 .* logps
62
62
@test getweights (pc) == exp .(2 .* logps) ./ sum (exp, 2 .* logps)
63
63
@test all (getweight (pc, i) ≈ exp (2 * logps[i]) / sum (exp, 2 .* logps) for i in 1 : 3 )
64
- @test logZ (pc) == log (sum (exp, 2 .* logps))
64
+ @test logZ (pc) ≈ log (sum (exp, 2 .* logps))
65
65
66
66
# Resample and propagate particles.
67
67
resample_propagate! (pc)
@@ -78,7 +78,7 @@ include(dir*"/test/test_utils/AllUtils.jl")
78
78
@test pc. logWs ⊆ logps
79
79
@test getweights (pc) == exp .(pc. logWs) ./ sum (exp, pc. logWs)
80
80
@test all (getweight (pc, i) ≈ exp (pc. logWs[i]) / sum (exp, pc. logWs) for i in 1 : 3 )
81
- @test logZ (pc) == log (sum (exp, pc. logWs))
81
+ @test logZ (pc) ≈ log (sum (exp, pc. logWs))
82
82
83
83
# Increase unnormalized logarithmic weights.
84
84
logws = copy (pc. logWs)
0 commit comments