Giter VIP home page Giter VIP logo

Comments (8)

daanhb avatar daanhb commented on August 22, 2024

That sounds doable. Currently the spheres are hardcoded to be EuclideanDomain, but ProductDomain already mostly works more generically. If you comment out the two checks in the inner constructor here, then you get this behaviour:

julia> using DomainSets

julia> b = 0..1.0
0.0..1.0

julia> domains = [b for i in 1:10]
10-element Array{Interval{:closed,:closed,Float64},1}:
 0.0..1.0
 0.0..1.0
 0.0..1.0
 0.0..1.0
 0.0..1.0
 0.0..1.0
 0.0..1.0
 0.0..1.0
 0.0..1.0
 0.0..1.0

julia> p = DomainSets.ProductDomain{typeof(domains),Vector{Float64},Vector{Float64}}(domains)
0.0..1.0 x 0.0..1.0 x 0.0..1.0 x 0.0..1.0 x 0.0..1.0 x 0.0..1.0 x 0.0..1.0 x 0.0..1.0 x 0.0..1.0 x 0.0..1.0

julia> rand(10)  p
true

julia> 2*rand(10)  p
false

(The final test will succeed with some probability.)
I've invoked the constructor explicitly here. It would be a matter of modifying the computation of the element types, plus finding a nicer way of invoking the constructor. Perhaps when invoked with an array of domains, a ProductDomain could use array's as type. When invoked with an argument list of domains, it could be a tuple.

It is similar with the spheres: there could be an AbstractHyperSphere{T} <: Domain{T} and an AbstractEuclideanHyperSphere{N,T} <: AbstractHyperSphere{SVector{N,T}}. And some syntax for constructing them. Care to look at it?

from domainsets.jl.

oschulz avatar oschulz commented on August 22, 2024

Maybe, yes. I have something similar in BAT.jl, for boundaries for likelihoods and priors and I was looking for a solution that's more generic. DomainSets may be a great fit.

from domainsets.jl.

daanhb avatar daanhb commented on August 22, 2024

Cool, I hope using DomainSets works out. You suggested an interesting generalization that fits well in the package, because the whole aim is to be general and avoid repetition in other packages. I will try to get to this particular issue soon, and update here.

from domainsets.jl.

oschulz avatar oschulz commented on August 22, 2024

Great, thanks! I think this could be a valuable building block for statistics/fitting/optimization/etc. applications, to avoid redundant functionality across packages.

from domainsets.jl.

daanhb avatar daanhb commented on August 22, 2024

Working on it in #55. It motivated working on some other issues as well, and #55 will perhaps take some time and additional effort before we can merge it I'm afraid.

from domainsets.jl.

oschulz avatar oschulz commented on August 22, 2024

Thanks, @daanhb! I'l try to pitch in at some point, I'll try to get a clearer idea on requirements - and how to represent them more cleanly than I do at the moment - first, for such applications (statistics/fitting/optimization/...).

from domainsets.jl.

daanhb avatar daanhb commented on August 22, 2024

The changes have been merged into version 0.3. The README is updated with a few examples of basic usage. Issues are to be expected - please report! :-)

from domainsets.jl.

oschulz avatar oschulz commented on August 22, 2024

Thanks a lot - will do!

from domainsets.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.