From 37004ab7a8f323e712b21469fb855a394cbb2a91 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Wed, 30 Nov 2022 16:43:14 +0400 Subject: [PATCH 1/3] Specialize `in(x::Num, I::AbstractInterval)` Along with https://github.com/JuliaMath/IntervalSets.jl/pull/126, this helps avoid ambiguities such as in https://github.com/JuliaApproximation/ApproxFun.jl/issues/847 --- src/domains.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/domains.jl b/src/domains.jl index 42be53d07..d7a0a428b 100644 --- a/src/domains.jl +++ b/src/domains.jl @@ -6,8 +6,9 @@ struct VarDomainPairing domain::Domain end -Base.:∈(variable::Union{Sym,Term,Num},domain::Domain) = VarDomainPairing(value(variable),domain) -Base.:∈(variable::Union{Sym,Term,Num},domain::Interval) = VarDomainPairing(value(variable),domain) +for D in [:Domain, :Interval, :AbstractInterval] + @eval Base.:∈(variable::Union{Sym,Term,Num},domain::$D) = VarDomainPairing(value(variable),domain) +end # Construct Interval domain from a Tuple Base.:∈(variable::Union{Sym,Term,Num},domain::NTuple{2,Real}) = VarDomainPairing(variable,Interval(domain...)) From dbc49fc342f374f473230407d758ea51e1734f33 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Thu, 1 Dec 2022 11:36:34 +0400 Subject: [PATCH 2/3] Specialize for TypedEngpointsInterval --- Project.toml | 3 ++- src/domains.jl | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index af5dd6df8..0678eff37 100644 --- a/Project.toml +++ b/Project.toml @@ -13,6 +13,7 @@ DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" DomainSets = "5b8099bc-c8ec-5219-889f-1d9e522a28bf" Groebner = "0b43b601-686d-58a3-8a1c-6623616c7cd4" IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" +IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953" LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" LambertW = "984bce1d-4616-540c-a9ee-88d1112d94c9" Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" @@ -46,6 +47,7 @@ DomainSets = "0.5" Groebner = "0.1, 0.2" IfElse = "0.1" LaTeXStrings = "1.3" +LambertW = "0.4.5" Latexify = "0.11, 0.12, 0.13, 0.14, 0.15" MacroTools = "0.5" Metatheory = "1.2.0" @@ -62,7 +64,6 @@ StaticArrays = "1.1" SymbolicUtils = "0.18, 0.19" TermInterface = "0.2, 0.3" TreeViews = "0.3" -LambertW = "0.4.5" julia = "1.6" [extras] diff --git a/src/domains.jl b/src/domains.jl index d7a0a428b..3c7fa2e38 100644 --- a/src/domains.jl +++ b/src/domains.jl @@ -1,4 +1,5 @@ -import DomainSets: Domain, Interval, AbstractInterval +import IntervalSets: Interval, AbstractInterval, TypedEndpointsInterval +import DomainSets: Domain import Symbolics: value, Sym, Term, Num struct VarDomainPairing @@ -6,7 +7,7 @@ struct VarDomainPairing domain::Domain end -for D in [:Domain, :Interval, :AbstractInterval] +for D in [:Domain, :Interval, :TypedEndpointsInterval] @eval Base.:∈(variable::Union{Sym,Term,Num},domain::$D) = VarDomainPairing(value(variable),domain) end From f03fa6ec9e9c5c2580fc43137f9cde1ac9cc3c90 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Thu, 1 Dec 2022 14:02:01 +0400 Subject: [PATCH 3/3] Compat bounds for IntervalSets --- Project.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Project.toml b/Project.toml index 0678eff37..d3ea36893 100644 --- a/Project.toml +++ b/Project.toml @@ -46,6 +46,7 @@ DocStringExtensions = "0.7, 0.8, 0.9" DomainSets = "0.5" Groebner = "0.1, 0.2" IfElse = "0.1" +IntervalSets = "0.5, 0.6, 0.7" LaTeXStrings = "1.3" LambertW = "0.4.5" Latexify = "0.11, 0.12, 0.13, 0.14, 0.15"