-
Notifications
You must be signed in to change notification settings - Fork 71
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
Remove IntervalBox in favor of AbstractVector{Interval} #550
Comments
Hmm that actually doesn't seem like the right approach to me, since an interval box is conceptually different from just "a vector of intervals". It is possible that you would want to somehow parametrize IntervalBox on the type of vector it contains, e.g. |
I have been wondering about this myself, what is conceptually different between |
e.g. diameter (i.e. the max width in some dimension), volume. |
From an outsider perspective, for any instance of |
from a type piracy perspective, I think only set functions could be problematic julia> setdiff([1..2, 3..4], [0..1, 1..2])
1-element Vector{Interval{Float64}}:
[3, 4]
julia> setdiff(IntervalBox([1..2, 3..4]), IntervalBox([0..1, 1..2]))
1-element Vector{IntervalBox{2, Float64}}:
[1, 2] × [3, 4]
julia> [1..2, 3..4] ⊆ [0..3, 1..5]
false
julia> IntervalBox([1..2, 3..4]) ⊆ IntervalBox([0..3, 1..5])
true and even that case above is maybe borderline whether is type piracy or not. I don't think |
Ah indeed, set functions are ambiguous. The type |
I'm not sure if this proposal incurs in type-piracy or not. Yet, it seems to me that the right approach is to define a Would that help unifying things? |
Having our own struct is however limited, because the interval extension of a user defined function will never return an It looks to me like the use of We could have definition for |
Please excuse me if there is a very apparent answer to this, but I'm curious why From multiple dispatch point of view, the upstream packages in the ecosystem, and applications using the ecosystem, might benefit from a common supertype. Just to give a very simple example from 'IntervalOptimisation': numeric_type(::Interval{T}) where {T} = T
numeric_type(::IntervalBox{N, T}) where {N, T} = T |
I think one difficulty in having |
Discussed in triage call, and the consensus is that it is reasonable to remove it. |
We discuss we Luca and it looks like we could get rid of
IntervalBox
alltogether, and just define its methods onAbstractVector{Interval}
.It would unify things, as a mutlidimensional function extended to intervals would always return a
Vector{Interval}
. This is currently a slight annoyance in IntervalRootFinding.It doesn't feel like it is type piracy (no clash is possible with other modules), and it doesn't seem to cause any problem (we only have few methods on
IntervalBox
and many are to emulate a vector).@lucaferranti @dpsanders @lbenet
The text was updated successfully, but these errors were encountered: