-
Notifications
You must be signed in to change notification settings - Fork 70
Release 1.0 #698
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
Draft
OlivierHnt
wants to merge
7
commits into
JuliaIntervals:master
Choose a base branch
from
OlivierHnt:release-1.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Release 1.0 #698
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6ca1cff
Set Julia compat to 1.10
OlivierHnt 99bddb0
Set ForwardDiff compat to 1.0
OlivierHnt aeb01d4
Rework display
OlivierHnt 20b9211
Rework comparison functionalities
OlivierHnt 339b41b
Remove ambiguous set functionalities
OlivierHnt 94e71c1
Change `@test_broken` to `@test`
OlivierHnt 2a5a428
Set default matmul mode to `:fast`
OlivierHnt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
version: | ||
- '1.9' | ||
- '1.10' | ||
- '1' | ||
- 'nightly' | ||
os: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -78,96 +78,77 @@ Base.hash(x::Interval, h::UInt) = hash(sup(x), hash(inf(x), hash(Interval, h))) | |||||||||
|
||||||||||
# | ||||||||||
|
||||||||||
for T ∈ (:BareInterval, :Interval) | ||||||||||
@eval begin | ||||||||||
function Base.:(==)(x::$T, y::$T) # also returned when calling `≤`, `≥`, `isequal` | ||||||||||
isthin(x) && return sup(x) == y | ||||||||||
isthin(y) && return x == sup(y) | ||||||||||
return throw(ArgumentError("`==` is purposely not supported when the intervals are overlapping. See instead `isequal_interval`")) | ||||||||||
end | ||||||||||
|
||||||||||
Base.:<(::$T, ::$T) = # also returned when calling `isless`, `>` | ||||||||||
throw(ArgumentError("`<` is purposely not supported for intervals. See instead `isstrictless`, `strictprecedes`")) | ||||||||||
|
||||||||||
Base.isdisjoint(::$T, ::$T) = | ||||||||||
throw(ArgumentError("`isdisjoint` is purposely not supported for intervals. See instead `isdisjoint_interval`")) | ||||||||||
|
||||||||||
Base.issubset(::$T, ::$T) = | ||||||||||
throw(ArgumentError("`issubset` is purposely not supported for intervals. See instead `issubset_interval`")) | ||||||||||
|
||||||||||
Base.issetequal(::$T, ::$T) = | ||||||||||
throw(ArgumentError("`issetequal` is purposely not supported for intervals. See instead `isequal_interval`")) | ||||||||||
|
||||||||||
Base.in(::$T, ::$T) = | ||||||||||
throw(ArgumentError("`in` is purposely not supported for intervals. See instead `in_interval`")) | ||||||||||
|
||||||||||
Base.isempty(::$T) = | ||||||||||
throw(ArgumentError("`isempty` is purposely not supported for intervals. See instead `isempty_interval`")) | ||||||||||
|
||||||||||
Base.isfinite(::$T) = # also returned when calling `isinf` | ||||||||||
throw(ArgumentError("`isfinite` is purposely not supported for intervals. See instead `isbounded`")) | ||||||||||
|
||||||||||
Base.isnan(::$T) = | ||||||||||
throw(ArgumentError("`isnan` is purposely not supported for intervals. See instead `isnai`")) | ||||||||||
|
||||||||||
Base.intersect(::$T) = | ||||||||||
throw(ArgumentError("`intersect` is purposely not supported for intervals. See instead `intersect_interval`")) | ||||||||||
|
||||||||||
Base.union!(::BitSet, ::$T) = # needed to resolve ambiguity | ||||||||||
throw(ArgumentError("`union!` is purposely not supported for intervals. See instead `hull`")) | ||||||||||
Base.union!(::AbstractSet, ::$T) = # also returned when calling `intersect`, `symdiff` with intervals | ||||||||||
throw(ArgumentError("`union!` is purposely not supported for intervals. See instead `hull`")) | ||||||||||
Base.union!(::AbstractVector{S}, ::$T) where {S} = | ||||||||||
throw(ArgumentError("`union!` is purposely not supported for intervals. See instead `hull`")) | ||||||||||
Base.union!(::AbstractVector{S}, ::$T, ::Any, ::Any...) where {S} = | ||||||||||
throw(ArgumentError("`union!` is purposely not supported for intervals. See instead `hull`")) | ||||||||||
Base.union!(::AbstractVector{S}, ::$T, ::$T, ::Any...) where {S} = | ||||||||||
throw(ArgumentError("`union!` is purposely not supported for intervals. See instead `hull`")) | ||||||||||
Base.union!(::AbstractVector{S}, ::Any, ::$T, ::Any...) where {S} = | ||||||||||
throw(ArgumentError("`union!` is purposely not supported for intervals. See instead `hull`")) | ||||||||||
|
||||||||||
Base.setdiff(::$T) = | ||||||||||
throw(ArgumentError("`setdiff` is purposely not supported for intervals. See instead `interiordiff`")) | ||||||||||
Base.setdiff!(::AbstractSet, ::$T) = | ||||||||||
throw(ArgumentError("`setdiff!` is purposely not supported for intervals. See instead `interiordiff`")) | ||||||||||
end | ||||||||||
function Base.:(==)(x::Interval, y::Interval) # also returned when calling `≤`, `≥`, `isequal` | ||||||||||
isthin(x) && return sup(x) == y | ||||||||||
isthin(y) && return x == sup(y) | ||||||||||
isdisjoint_interval(x, y) && return false | ||||||||||
return throw(ArgumentError("`==` is purposely not supported when the intervals are overlapping. See instead `isequal_interval`")) | ||||||||||
end | ||||||||||
Base.union!(::AbstractVector{S}, ::BareInterval, ::Interval, ::Any...) where {S} = | ||||||||||
|
||||||||||
function Base.:<(x::Interval, y::Interval) | ||||||||||
isthin(x) && return sup(x) < y | ||||||||||
isthin(y) && return x < sup(y) | ||||||||||
strictprecedes(x, y) && return true | ||||||||||
strictprecedes(y, x) && return false | ||||||||||
return throw(ArgumentError("`<` is purposely not supported when the intervals are overlapping. See instead `strictprecedes`")) | ||||||||||
end | ||||||||||
|
||||||||||
# Base.isdisjoint(::Interval, ::Interval) = | ||||||||||
# throw(ArgumentError("`isdisjoint` is purposely not supported for intervals. See instead `isdisjoint_interval`")) | ||||||||||
|
||||||||||
# Base.issubset(::Interval, ::Interval) = | ||||||||||
# throw(ArgumentError("`issubset` is purposely not supported for intervals. See instead `issubset_interval`")) | ||||||||||
|
||||||||||
# Base.issetequal(::Interval, ::Interval) = | ||||||||||
# throw(ArgumentError("`issetequal` is purposely not supported for intervals. See instead `isequal_interval`")) | ||||||||||
|
||||||||||
# Base.in(::Interval, ::Interval) = | ||||||||||
# throw(ArgumentError("`in` is purposely not supported for intervals. See instead `in_interval`")) | ||||||||||
|
||||||||||
Base.isempty(::Interval) = | ||||||||||
throw(ArgumentError("`isempty` is purposely not supported for intervals. See instead `isempty_interval`")) | ||||||||||
|
||||||||||
Base.isfinite(::Interval) = # also returned when calling `isinf` | ||||||||||
throw(ArgumentError("`isfinite` is purposely not supported for intervals. See instead `isbounded`")) | ||||||||||
|
||||||||||
Base.isnan(::Interval) = | ||||||||||
throw(ArgumentError("`isnan` is purposely not supported for intervals. See instead `isnai`")) | ||||||||||
|
||||||||||
Base.intersect(::Interval) = | ||||||||||
throw(ArgumentError("`intersect` is purposely not supported for intervals. See instead `intersect_interval`")) | ||||||||||
|
||||||||||
Base.union!(::BitSet, ::Interval) = # needed to resolve ambiguity | ||||||||||
throw(ArgumentError("`union!` is purposely not supported for intervals. See instead `hull`")) | ||||||||||
Base.union!(::AbstractSet, ::Interval) = # also returned when calling `intersect`, `symdiff` with intervals | ||||||||||
throw(ArgumentError("`union!` is purposely not supported for intervals. See instead `hull`")) | ||||||||||
Base.union!(::AbstractVector{S}, ::Interval) where {S} = | ||||||||||
throw(ArgumentError("`union!` is purposely not supported for intervals. See instead `hull`")) | ||||||||||
Base.union!(::AbstractVector{S}, ::Interval, ::BareInterval, ::Any...) where {S} = | ||||||||||
Base.union!(::AbstractVector{S}, ::Interval, ::Any, ::Any...) where {S} = | ||||||||||
throw(ArgumentError("`union!` is purposely not supported for intervals. See instead `hull`")) | ||||||||||
Base.union!(::AbstractVector{S}, ::Interval, ::Interval, ::Any...) where {S} = | ||||||||||
throw(ArgumentError("`union!` is purposely not supported for intervals. See instead `hull`")) | ||||||||||
Base.union!(::AbstractVector{S}, ::Any, ::Interval, ::Any...) where {S} = | ||||||||||
throw(ArgumentError("`union!` is purposely not supported for intervals. See instead `hull`")) | ||||||||||
|
||||||||||
Base.setdiff(::Interval) = | ||||||||||
throw(ArgumentError("`setdiff` is purposely not supported for intervals. See instead `interiordiff`")) | ||||||||||
Base.setdiff!(::AbstractSet, ::Interval) = | ||||||||||
throw(ArgumentError("`setdiff!` is purposely not supported for intervals. See instead `interiordiff`")) | ||||||||||
|
||||||||||
# pointwise equality | ||||||||||
|
||||||||||
""" | ||||||||||
==(::BareInterval, ::Number) | ||||||||||
==(::Number, ::BareInterval) | ||||||||||
==(::Interval, ::Number) | ||||||||||
==(::Number, ::Interval) | ||||||||||
|
||||||||||
Test whether an interval is the singleton of a given number. In other words, the | ||||||||||
result is true if and only if the interval contains only that number. | ||||||||||
|
||||||||||
!!! note | ||||||||||
Comparison between intervals is purposely disallowed. Indeed, equality | ||||||||||
between non-singleton intervals has distinct properties, notably ``x = y`` | ||||||||||
does not imply ``x - y = 0``. See instead [`isequal_interval`](@ref). | ||||||||||
""" | ||||||||||
Base.:(==)(x::Union{BareInterval,Interval}, y::Number) = isthin(x, y) | ||||||||||
Base.:(==)(x::Number, y::Union{BareInterval,Interval}) = y == x | ||||||||||
Base.:(==)(x::Interval, y::Number) = !isthin(x) & in_interval(y, x) ? throw(ArgumentError("`==` is purposely not supported when the number is contained in the interval. See instead `isthin`")) : isthin(x, y) | ||||||||||
Base.:(==)(x::Number, y::Interval) = y == x | ||||||||||
# needed to resolve ambiguity from irrationals.jl | ||||||||||
Base.:(==)(x::Interval, y::AbstractIrrational) = isthin(x, y) | ||||||||||
Base.:(==)(x::Interval, y::AbstractIrrational) = !isthin(x) & in_interval(y, x) ? throw(ArgumentError("`==` is purposely not supported when the number is contained in the interval. See instead `isthin`")) : isthin(x, y) | ||||||||||
Base.:(==)(x::AbstractIrrational, y::Interval) = y == x | ||||||||||
# needed to resolve ambiguity from complex.jl | ||||||||||
Base.:(==)(x::Interval, y::Complex) = isreal(y) & (real(y) == x) | ||||||||||
Base.:(==)(x::Complex, y::Interval) = y == x | ||||||||||
|
||||||||||
# follows docstring of `Base.iszero` | ||||||||||
Base.iszero(x::Union{BareInterval,Interval}) = isthinzero(x) | ||||||||||
|
||||||||||
# follows docstring of `Base.isone` | ||||||||||
Base.isone(x::Union{BareInterval,Interval}) = isthinone(x) | ||||||||||
Base.:<(x::Interval, y::Real) = (!isthin(x) & in_interval(y, x)) | isempty_interval(x) ? throw(ArgumentError("`<` is purposely not supported when the number is contained in the interval, or if the interval is empty")) : sup(x) < y | ||||||||||
Base.:<(x::Real, y::Interval) = (!isthin(y) & in_interval(x, y)) | isempty_interval(y) ? throw(ArgumentError("`<` is purposely not supported when the number is contained in the interval, or if the interval is empty")) : x < inf(y) | ||||||||||
Comment on lines
+150
to
+151
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I got tripped by the precedence of Why are |
||||||||||
|
||||||||||
|
||||||||||
# follows docstring of `Base.isinteger` | ||||||||||
Base.isinteger(x::Union{BareInterval,Interval}) = isthininteger(x) | ||||||||||
Base.isinteger(x::Interval) = !isthin(x) & !isdisjoint_interval(x, floor(x), ceil(x)) ? throw(ArgumentError("`isinteger` is purposely not supported for non-thin containing at least one integer. See instead `isthininteger`")) : isthininteger(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These overrides should be brought back to be consistent with #719