-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use DomainSets.jl? #16
Comments
☝️ 😕 Well, that didn't work |
AFAIC, the main benefit of using domains for me was being able to integrate a measure over a set. This can be useful to normalize it, or to simulate Poisson processes for instance. |
Just pointing out DomainIntegrals.jl here, a package for (numerically) evaluating integrals over domains, possibly with respect to a measure. The included measures are heavily biased towards approximation theory though, e.g. weight functions for orthogonal polynomials, and not very well developed. DomainSets itself also has some of that bias, to be honest. |
Thanks @daanhb , DomainIntegrals looks really nice! Off hand, challenges to address are
We'll also need to get to things like measures on function spaces, so other packages from JuliaApproximation could well come into play. From what I'm seeing so far, it seems like it could make sense to move toward having DomainSets as a dependency for MeasureBase. The fact that it's easily extensible should give us lots of flexibility. The main interest is not so much for its included measures (though that could be interesting as well) but as a way to describe supports of measures we build. We could consider adding DomainIntegrals as a dependency for MeasureTheory (not MeasureBase), though we should first look at advantages of this over just keeping it separate. I mean, if we start with DomainSets, it might be easy enough for DomainIntegrals to "just work" without the need to have it as a dependency. Then packages like @gdalle is building could still take advantage of it. |
That sounds good. Small comment: measures are only defined in DomainIntegrals.jl, not in DomainSets. At some point they'll probably move to a package that is yet-to-be-named, or even better, be replaced with an existing package. |
Simple proof of concept here: There's really not much to it, more interesting will be to see how this change would affect MeasureTheory.jl |
This is really helpful (thanks @daanhb ): So one possibility would be for a Measure to be parameterized by a Domain. It would be really nice to not have to worry about domains, and to have a clean connection to the JuliaApproximation tools. My biggest concern at this point is with how this could affect @sethaxen's work on Daan or Seth (or others), what do you think? |
I haven't really been following this discussion, but this is similar to the solution I have been using for ManifoldMeasures.jl. There, each measure is associated with a manifold. Because some measures can be written generically for multiple manifolds (e.g. If one wanted to do the same thing with MeasureTheory but using Domains, this would be fine unless core functionality of MeasureTheory unnecessarily relied on a domain being defined as as a subtype of some type in DomainSets. An option is to now have a type constraint, which could allow swapping a |
If I'm understanding correctly, this should be ok as long as every
DomainSets seems to have very nice handling of unions and products. So I think we can have some simple laws like the domain of a and the domain of a Other interesting things:
|
Just to confirm, we like to avoid requiring domains be a subtype of |
While all In ManifoldMeasures, for sampling, we have had to make this more explicit by defining a |
Probably worth noting again that Distributions.jl has very weird julia> using Distributions
julia> eltype(Normal())
Float64
julia> eltype(MvNormal(ones(3)))
Float64 This doesn't compose well, but it's probably much to late to fix. I had thought this meant we should avoid julia> eltype(AbstractArray{AbstractVector{Real}})
AbstractVector{Real} (alias for AbstractArray{Real, 1}) Also, there's a default method: julia> abstract type T end
julia> eltype(T)
Any So in the
I guess this just becomes a universal quantifier? |
In our uses of DomainSets for function approximation it is useful to have a The simplest examples are intervals. The closed interval julia> eltype(Interval(0,1))
Int64
julia> eltype(Interval(0.0,1.0))
Float64
julia> 0.5 ∈ Interval(0,1)
true
julia> Interval(0,1) == Interval(0.0,1.0)
true It is a bit like the standard Julia behaviour of membership for arrays: julia> 2 ∈ [1.0, 2.0, 3.0]
true
julia> 2.0 ∈ [1, 2, 3]
true
julia> [1,2,3] == [1.0, 2.0, 3.0]
true I guess this makes the Being convinced over time that this notion of |
So Manifolds.jl is well developed I see. Also, interoperability by design is fun: julia> using DomainSets, Manifolds
julia> M1 = Manifolds.Sphere(2)
Sphere(2, ℝ)
julia> M2 = Manifolds.Circle()
Circle(ℝ)
julia> d = uniondomain(M1, M2)
Sphere(2, ℝ) ∪ Circle(ℝ)
julia> 0.5 ∈ d
true The example doesn't necessarily make sense, but it works :-) |
You had me worried for a minute, since this sounded a little like the weird julia> d1 = ProductDomain(map(Interval, rand(10), rand(10)))
D₁ × D₃ × D₂ × ... × D₄
D₁ = 0.04102775113924917..0.7543070839059667
D₂ = 0.0301860782231258..0.3334968805199827
D₃ = 0.1203453376504664..0.31294581525887777
D₄ = 0.8943245774798796..0.021646286220368793
julia> typeof(d1)
Rectangle{Vector{Float64}}
julia> eltype(d1)
Vector{Float64} (alias for Array{Float64, 1}) This is a little bit of a tangent, but things like |
Just reviving this discussion to mention LazySets.jl, which mostly contains lazy implementations of convex polyhedra, but some of its functions work for general sets. |
Other related discussions: |
Our domains.jl is currently kind of hacked together. When I wondered about replacing this with ManifoldsBase, @gdalle reminded me about DomainSets.jl:
Funnily enough, we had some brief discussion about this three years ago here.
There are a few places domains come up, though we don't currently have a uniform interface for managing them
logdensity
and replace these cases with-Inf
⊆
, for≪
computations (nested supports are necessary for absolute continuity)∩
for supports of pointwise product (⊙
)∪
for superposition (+
)Some potential concerns:
StaticArrays
, which is a heavy dependency for a core library like this. Would it be possible to refactor DomainSets somewhat to use Static.jl instead, possibly with an optional StaticArrays dependency? Or maybe there's a better approach? (This part should probably be a new issue in DomainsSets, cc @daanhb @dlfivefifty)The text was updated successfully, but these errors were encountered: