Skip to content

Commit

Permalink
Product of Diracs (#223)
Browse files Browse the repository at this point in the history
* Product of Diracs

* bump version
  • Loading branch information
cscherrer authored Aug 14, 2022
1 parent b42228f commit e4aa5cf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MeasureTheory"
uuid = "eadaa1a4-d27c-401d-8699-e962e1bbc33b"
authors = ["Chad Scherrer <[email protected]> and contributors"]
version = "0.17.0"
version = "0.17.1"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
4 changes: 4 additions & 0 deletions src/combinators/product.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ function as(d::PowerMeasure)
as(Array, as(d.parent), length.(d.axes)...)
end

function as(d::ProductMeasure{<:AbstractArray{<:Dirac}})
return asConst(testvalue.(marginals(d)))
end

function as(d::ProductMeasure{A}) where {A<:AbstractArray}
mar = marginals(d)
ts = map(as, mar)
Expand Down
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ end
end
end

@testset "Product of Diracs" begin
x = randn(3)
t = as(productmeasure(Dirac.(x)))
@test transform(t, []) == x
end

# @testset "Univariate chain" begin
# ξ0 = 1.
# x = 1.2
Expand Down

2 comments on commit e4aa5cf

@cscherrer
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/66242

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.17.1 -m "<description of version>" e4aa5cf4a0a8b4e5c4136c5d213ae2e482da0457
git push origin v0.17.1

Please sign in to comment.