Skip to content

Commit e4aa5cf

Browse files
authored
Product of Diracs (#223)
* Product of Diracs * bump version
1 parent b42228f commit e4aa5cf

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MeasureTheory"
22
uuid = "eadaa1a4-d27c-401d-8699-e962e1bbc33b"
33
authors = ["Chad Scherrer <[email protected]> and contributors"]
4-
version = "0.17.0"
4+
version = "0.17.1"
55

66
[deps]
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"

src/combinators/product.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ function as(d::PowerMeasure)
22
as(Array, as(d.parent), length.(d.axes)...)
33
end
44

5+
function as(d::ProductMeasure{<:AbstractArray{<:Dirac}})
6+
return asConst(testvalue.(marginals(d)))
7+
end
8+
59
function as(d::ProductMeasure{A}) where {A<:AbstractArray}
610
mar = marginals(d)
711
ts = map(as, mar)

test/runtests.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@ end
275275
end
276276
end
277277

278+
@testset "Product of Diracs" begin
279+
x = randn(3)
280+
t = as(productmeasure(Dirac.(x)))
281+
@test transform(t, []) == x
282+
end
283+
278284
# @testset "Univariate chain" begin
279285
# ξ0 = 1.
280286
# x = 1.2

0 commit comments

Comments
 (0)