-
Notifications
You must be signed in to change notification settings - Fork 27
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
Roadmap #1
Comments
Looks good. A couple of comments/questions:
|
Subset as in if A belongs to B i.e. ⊆, ⊇, ⊃ et al. :) |
Oh, gotcha. That's called |
Regarding |
Do we check for this every time a |
If you don't check for |
I would say I don't think it's a problem that the empty set is both closed and open; we also have the property that julia> isa((), NTuple{0, Int})
true
julia> isa((), NTuple{0, Float64})
true |
You only check it when asked to do so, by calling |
Ah, gotcha. Thanks for the explanation, Tim. That sounds like the best course of action to me. |
The fanciest thing the constructor should do is promotion, ClosedSet(a, b) = ClosedSet(promote(a,b)...) |
@dpsanders might be interested in this as well. |
I'd also add the autoswap{T}(a::T, b::T) = ifelse(a < b, (a, b), (b, a))
autoswap(a, b) = autoswap(promote(a, b)...) (but of course the constructor doesn't call this, it has to be called manually, EDIT: or maybe |
This looks good, but just for the record seems to be duplicating a lot of functionality in ValidatedNumerics.jl. |
On that note: what is the purpose of this package? |
Background is here and here. The most important points are:
So the idea is that this package just represents a connect set on an ordered domain, and nothing more. But no objections if people add operations to these sets in other packages. |
Thanks, that was useful. Would be good to add that to the README. |
To be concrete, the functionality should be similar to the two files Aside from having a trivial constructor, there will be small differences:
But other than those, the two look quite compatible. See #2 for a nearly-complete implementation |
I like the idea of a package that just defines the object and set operations, independent of interval arithmetic. Should this (down the line) be part of a broader set theoretic package? To support, for example, (1..2) ∪ (3..4), OpenIntervals, etc.? I'd be happy to contribute to that (some of which is implemented in ApproxFun but needs to be cleaned up.) |
Yes, we've set this up so that open & half-open intervals should also be supportable. Strictly speaking |
I'm not proposing to include additional functionality in this package. Rather, that The relevance to this package is that
My application: Representing functions on a disjoint union of two sets. |
Here's an example relevant to interval arithmetic: d=(-1)..1
f = x->sign(x)+x
f(d) # should be (-2..-1) ∪ (1..2) |
Though probably it should actually be ClosedOpenInterval(-2,-1) ∪ ClosedInterval(0,0) ∪ OpenClosedInterval(1,2) |
As far as the abstraction goes, see Line 5 in 9a4d3ea
|
OK I mean abstract AbstractInterval{T} <: Set{T} |
And I'm posing this more as a question than a proposal: I need to use more than one type of set, with interval being an important case. Should this use case, where ClosedInterval is one type of set, be taken into account in the design of IntervalSets.jl? The only action item at the moment would be another layer called |
@timholy holy For a reasonably sophisticated package that is based on unions of (in general, Cartesian products of) intervals, see IntervalConstraintProgramming.jl. (This is a registered package, but as far as I remember I have not yet announced it, since it is currently undergoing major development.) Something similar is in @zenna's Basically, the idea is to approximate an arbitrary set, e.g. the feasible set satisfied by a collection of constraints, using a collection of non-overlapping boxes. On the other hand, I'm not sure how useful such a thing would be in the abstract, without actually being able to calculate things to do with the boxes. @dlfivefifty I like the idea, but note that the name Finally, I wonder how easy it would be to actually use this underneath e.g. |
@dpsanders raises a good point: you wouldn't want other packages overriding Base commands (such as Base.+) for ClosedInterval, as it could lead to conflicting packages. Perhaps there should be AbstractDomains.jl is exactly what I'm thinking of. The question is whether |
Another source of conflict/redundancy is the notion of a point. I guess ClosedInterval(0.,0.) is meant to represent the point 0? |
@dpsanders I don't think connectedness ( A slightly complicated example of why is if there were to be a type |
Same logic applies to openness and closedness: |
I think it would be fine to introduce a layer above. Note that help?> Set
search: Set setenv setdiff setdiff! setfield! setindex! setrounding setprecision set_rounding set_zero_subnormals set_bigfloat_precision reset IntSet issetuid issetgid insert! InsertionSort
Set([itr])
Construct a Set of the values generated by the given iterable object, or an empty set. Should be used instead of IntSet for sparse integer sets, or for sets of arbitrary objects. |
When there's really only one reasonable meaning, then extending arithmetic operations on these intervals seems perfectly fine. For example, |
If it's disambiguous, it should probably be in this package. So for example +(::ClosedInterval{Int},::Integer) could be overridden. But for floating arithmetic there are multiple possible definitions... |
I both agree and disagree. A user who wants to think in terms of pure topology might not want them. We could conceivably have a system like Can you clarify why there are multiple definitions of + with floating point? |
There may be uses for different rounding modes. While the ValidatedNumerics.jl rounding mode with guaranteed containment is probably the only useful one for ClosedInterval, one could imagine cases where you would want the guaranteed containment to go the other way around. This is more applicable for open intervals, where the open endpoint may indicate a singularity (e.g., the domain that The reason to include the non-ambiguous overrides in this package is that, in 0.5, there will be warnings if multiple packages implement the same functions. A user interested in pure topology can ignore features they don't want to use. |
Thanks for the explanation. I see your point. We could have a common |
OK I'll make a pull request with the abstract type. I'd propose @zenna is AbstractDomains.jl still being developed? If so, I might make a pull request to use |
Is there any appetite to move some of this and particularly the It seems small enough and really useful to me, and I can imagine a lot of packages (in disparate fields/settings) wanting to use the syntax in the future, so it would be good to have a common starting point. (I think part of the productivity of Julia is that all the packages are working together pretty seamlessly). |
I think it's a mistake unless all the appropriate Base overrides are doable, but there is an open question about what to do with |
Yes, union is tricky. I guess I meant really bare bones - just |
Except they usually say don't overload functions that only have Base types. Of course, that policy is likely to be incompatible with the current goal of moving stuff out of Base... |
The intended point of this package is to be that bare-bones package of which you speak, and rampant type-piracy is very much encouraged. Can you go through the source code and tell me which things seem controversial? Anything that is controversial should be moved out to a separate package.
If you want that to return an |
Although I guess if you think of the set on which the topology is defined as being One thought is that we need a second parameter to |
If |
But it can't be an Probably the best way to make sure that succeeds is to call it as |
I think |
Yeah, for our use purposes it's vital because we do really compute-intensive stuff involving I'd be inclined to say |
In that case I withdraw my argument for this not being in Base (not that I particularly think it should or shouldn't be.) |
This issue seems not active and is not focusing on a specific issue, so I'll close this issue. See #41 for a discussion of |
@timholy What all functionality would be a good start for this package?
Currently doing
ClosedSet
. For this, if someone does ClosedSet(a, b) where a>b what should be the behaviour?The text was updated successfully, but these errors were encountered: