JuliaMath / JuliaMath/MeasureBase.jl

`productmeasure(::Vector{<:Dirac})`

Open
#80 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
32
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Currently, a product of `Dirac`s works like this:
```julia
julia> productmeasure(Dirac.([1,2,3]))
ProductMeasure([Dirac(1), Dirac(2), Dirac(3)])
```
In some cases, we might prefer to write this as
```julia
Dirac([1, 2, 3])
```

This is much simpler, at the cost of an allocation.

For cases where we end up building an array of `Dirac`s only to later take a product, we should look for ways to think ahead, so we can jump straight to this second representation. In this case we can often avoid the allocation.

I don't think there's a need to have a single canonical form for this. We can instead add some methods to deal with `ProductMeasure{<:AbstractArray{<:Dirac}}` and take advantage of this structure.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.