@@ -20,7 +20,6 @@ d = ∫exp(x -> -x^2, Lebesgue(ℝ))
20
20
# return (x,y)
21
21
# end
22
22
23
-
24
23
test_measures = [
25
24
# Chain(x -> Normal(μ=x), Normal(μ=0.0))
26
25
# For(3) do j
@@ -53,8 +52,8 @@ testbroken_measures = [
53
52
for μ in test_measures
54
53
@info " testing $μ "
55
54
test_interface (μ)
56
- test_interface (μ ^ 3 )
57
- test_interface (μ ^ (3 ,2 ))
55
+ test_interface (μ^ 3 )
56
+ test_interface (μ^ (3 , 2 ))
58
57
test_interface (5 * μ)
59
58
# test_interface(SpikeMixture(μ, 0.2))
60
59
end
105
104
# end
106
105
# end
107
106
108
-
109
107
@testset " powers" begin
110
- @test logdensityof (Lebesgue () ^ 3 , 2 ) == logdensityof (Lebesgue () ^ (3 ,), 2 )
111
- @test logdensityof (Lebesgue () ^ 3 , 2 ) == logdensityof (Lebesgue () ^ (3 ,1 ), (2 ,0 ))
108
+ @test logdensityof (Lebesgue ()^ 3 , 2 ) == logdensityof (Lebesgue ()^ (3 ,), 2 )
109
+ @test logdensityof (Lebesgue ()^ 3 , 2 ) == logdensityof (Lebesgue ()^ (3 , 1 ), (2 , 0 ))
112
110
end
113
111
114
112
@testset " Half" begin
@@ -176,41 +174,41 @@ end
176
174
end
177
175
178
176
@testset " logdensity_rel" begin
179
- @test logdensity_rel (Dirac (0.0 )+ Lebesgue (), Dirac (1.0 ), 0.0 ) == Inf
180
- @test logdensity_rel (Dirac (0.0 )+ Lebesgue (), Dirac (1.0 ), 1.0 ) == - Inf
181
- @test logdensity_rel (Dirac (0.0 )+ Lebesgue (), Dirac (1.0 ), 2.0 ) == Inf
182
- @test logdensity_rel (Dirac (0.0 )+ Lebesgue (), Dirac (0.0 ), 0.0 ) == 0.0
183
- @test logdensity_rel (Dirac (0.0 )+ Lebesgue (), Dirac (0.0 ), 1.0 ) == Inf
184
- @test logdensity_rel (Dirac (0.0 )+ Lebesgue (), Lebesgue (), 0.0 ) == Inf
185
- @test logdensity_rel (Dirac (0.0 )+ Lebesgue (), Lebesgue (), 1.0 ) == 0.0
186
-
187
- @test logdensity_rel (Dirac (1.0 ), Dirac (0.0 )+ Lebesgue (), 0.0 ) == - Inf
188
- @test logdensity_rel (Dirac (1.0 ), Dirac (0.0 )+ Lebesgue (), 1.0 ) == Inf
189
- @test logdensity_rel (Dirac (1.0 ), Dirac (0.0 )+ Lebesgue (), 2.0 ) == - Inf
190
- @test logdensity_rel (Dirac (0.0 ), Dirac (0.0 )+ Lebesgue (), 0.0 ) == 0.0
191
- @test logdensity_rel (Dirac (0.0 ), Dirac (0.0 )+ Lebesgue (), 1.0 ) == - Inf
192
- @test logdensity_rel (Lebesgue (), Dirac (0.0 )+ Lebesgue (), 0.0 ) == - Inf
193
- @test logdensity_rel (Lebesgue (), Dirac (0.0 )+ Lebesgue (), 1.0 ) == 0.0
194
-
177
+ @test logdensity_rel (Dirac (0.0 ) + Lebesgue (), Dirac (1.0 ), 0.0 ) == Inf
178
+ @test logdensity_rel (Dirac (0.0 ) + Lebesgue (), Dirac (1.0 ), 1.0 ) == - Inf
179
+ @test logdensity_rel (Dirac (0.0 ) + Lebesgue (), Dirac (1.0 ), 2.0 ) == Inf
180
+ @test logdensity_rel (Dirac (0.0 ) + Lebesgue (), Dirac (0.0 ), 0.0 ) == 0.0
181
+ @test logdensity_rel (Dirac (0.0 ) + Lebesgue (), Dirac (0.0 ), 1.0 ) == Inf
182
+ @test logdensity_rel (Dirac (0.0 ) + Lebesgue (), Lebesgue (), 0.0 ) == Inf
183
+ @test logdensity_rel (Dirac (0.0 ) + Lebesgue (), Lebesgue (), 1.0 ) == 0.0
184
+
185
+ @test logdensity_rel (Dirac (1.0 ), Dirac (0.0 ) + Lebesgue (), 0.0 ) == - Inf
186
+ @test logdensity_rel (Dirac (1.0 ), Dirac (0.0 ) + Lebesgue (), 1.0 ) == Inf
187
+ @test logdensity_rel (Dirac (1.0 ), Dirac (0.0 ) + Lebesgue (), 2.0 ) == - Inf
188
+ @test logdensity_rel (Dirac (0.0 ), Dirac (0.0 ) + Lebesgue (), 0.0 ) == 0.0
189
+ @test logdensity_rel (Dirac (0.0 ), Dirac (0.0 ) + Lebesgue (), 1.0 ) == - Inf
190
+ @test logdensity_rel (Lebesgue (), Dirac (0.0 ) + Lebesgue (), 0.0 ) == - Inf
191
+ @test logdensity_rel (Lebesgue (), Dirac (0.0 ) + Lebesgue (), 1.0 ) == 0.0
192
+
195
193
@test isnan (logdensity_rel (Dirac (0 ), Dirac (1 ), 2 ))
196
194
end
197
195
198
196
@testset " Density measures and Radon-Nikodym" begin
199
197
x = randn ()
200
198
f (x) = x^ 2
201
- @test logdensityof (𝒹 (∫exp (f, Lebesgue ()), Lebesgue ()),x ) ≈ f (x)
199
+ @test logdensityof (𝒹 (∫exp (f, Lebesgue ()), Lebesgue ()), x ) ≈ f (x)
202
200
203
201
let f = 𝒹 (∫exp (x -> x^ 2 , Lebesgue ()), Lebesgue ())
204
- @test logdensityof (f,x) ≈ x^ 2
202
+ @test logdensityof (f, x) ≈ x^ 2
205
203
end
206
204
207
- # let d = ∫exp(log𝒹(Cauchy(), Normal()), Normal())
208
- # @test logdensity_def(d, x) ≈ logdensity_def(Cauchy(), x)
209
- # end
205
+ # let d = ∫exp(log𝒹(Cauchy(), Normal()), Normal())
206
+ # @test logdensity_def(d, x) ≈ logdensity_def(Cauchy(), x)
207
+ # end
210
208
211
- # let f = log𝒹(∫exp(x -> x^2, Normal()), Normal())
212
- # @test f(x) ≈ x^2
213
- # end
209
+ # let f = log𝒹(∫exp(x -> x^2, Normal()), Normal())
210
+ # @test f(x) ≈ x^2
211
+ # end
214
212
end
215
213
216
214
include (" combinators/weighted.jl" )
0 commit comments