From 3d4d1130e1ae8e52891de2430196990bb682aed6 Mon Sep 17 00:00:00 2001 From: Tianyi Pu <912396513@qq.com> Date: Sat, 7 Dec 2024 23:46:04 +0000 Subject: [PATCH] remove ambiguity resolvers of Infinities https://github.com/JuliaMath/Infinities.jl/pull/40 --- Project.toml | 3 +- ext/PTYQoLInfinitiesExt.jl | 91 -------------------------------------- 2 files changed, 1 insertion(+), 93 deletions(-) delete mode 100644 ext/PTYQoLInfinitiesExt.jl diff --git a/Project.toml b/Project.toml index ae285fd..f3808b6 100644 --- a/Project.toml +++ b/Project.toml @@ -14,7 +14,6 @@ ClassicalOrthogonalPolynomials = "b30e2e7b-c4ee-47da-9d5f-2c5c27239acd" ContinuumArrays = "7ae1f121-cc2c-504b-ac30-9b923412ae5c" DomainSets = "5b8099bc-c8ec-5219-889f-1d9e522a28bf" InfiniteArrays = "4858937d-0d70-526a-a4dd-2d5cb5dd786c" -Infinities = "e1ba4f0e-776d-440f-acd9-e1d2e9742647" IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953" IrrationalConstants = "92d709cd-6900-40b7-9082-c6be49f344b6" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -31,7 +30,6 @@ PTYQoLClassicalOrthogonalPolynomialsExt = "ClassicalOrthogonalPolynomials" PTYQoLContinuumArraysExt = "ContinuumArrays" PTYQoLDomainSetsExt = "DomainSets" PTYQoLInfiniteArraysExt = "InfiniteArrays" -PTYQoLInfinitiesExt = "Infinities" PTYQoLIntervalSetsExt = "IntervalSets" PTYQoLIrrationalConstantsExt = "IrrationalConstants" PTYQoLLinearAlgebraExt = "LinearAlgebra" @@ -44,6 +42,7 @@ julia = "1" Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" BeepBeep = "97dd0070-d6c0-43ac-b134-ca84cdbd343e" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +Infinities = "e1ba4f0e-776d-440f-acd9-e1d2e9742647" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/ext/PTYQoLInfinitiesExt.jl b/ext/PTYQoLInfinitiesExt.jl deleted file mode 100644 index cae2c91..0000000 --- a/ext/PTYQoLInfinitiesExt.jl +++ /dev/null @@ -1,91 +0,0 @@ -module PTYQoLInfinitiesExt - -import Base: +, -, *, div, cld, mod, ==, <, isless, ≤, fld, TwicePrecision, AbstractChar, Bool -import Base.Checked: checked_sub, checked_mul -import Infinities: InfiniteCardinal, ∞, Infinity, ComplexInfinity, RealInfinity, NotANumber, ℵ₀, _convert - -RealInfinity(x::Complex) = RealInfinity(Bool(x)) -RealInfinity(x::TwicePrecision) = RealInfinity(Bool(x)) -RealInfinity(x::AbstractChar) = RealInfinity(Bool(x)) -ComplexInfinity(x::Complex) = ComplexInfinity(Real(x)) -ComplexInfinity{T}(x::TwicePrecision) where T<:Real = ComplexInfinity(T(x)) -ComplexInfinity{T}(x::AbstractChar) where T<:Real = ComplexInfinity(T(x)) - -Bool(x::RealInfinity) = _convert(Bool, x) -Bool(x::Infinity) = _convert(Bool, x) - -+(::InfiniteCardinal, x::Rational) = ∞ + x -+(x::Rational, ::InfiniteCardinal) = x + ∞ -+(x::Complex, ::InfiniteCardinal) = x + ∞ -+(x::Complex{Bool}, ::InfiniteCardinal) = x + ∞ -+(::InfiniteCardinal, x::Complex{Bool}) = ∞ + x -+(::InfiniteCardinal, x::Complex) = ∞ + x - --(x::InfiniteCardinal, y::InfiniteCardinal) = x > y ? x : -∞ --(x::Infinity, y::ComplexInfinity) = x + (-y) --(::InfiniteCardinal, x::Complex{Bool}) = ∞ - x --(::InfiniteCardinal, x::Complex) = ∞ - x --(::InfiniteCardinal, x::Rational) = ∞ - x --(x::Complex, ::InfiniteCardinal) = x - ∞ --(x::Complex{Bool}, ::InfiniteCardinal) = x - ∞ --(x::Rational, ::InfiniteCardinal) = x - ∞ --(::Complex{Bool}, y::RealInfinity) = -y --(::Complex, y::RealInfinity) = -y - -*(x::InfiniteCardinal, y::InfiniteCardinal) = max(x,y) -*(x::InfiniteCardinal, y::Complex) = y*x -*(x::InfiniteCardinal, y::Complex{Bool}) = y*x -*(x::RealInfinity, y::Complex{Bool}) = ComplexInfinity(x)*y -*(a::Complex{Bool}, y::Infinity) = a*ComplexInfinity(y) -*(a::Complex{Bool},y::RealInfinity) = a*ComplexInfinity(y) -*(a::Rational, ::InfiniteCardinal) = a * ∞ -*(a::Complex{Bool}, ::InfiniteCardinal) = a * ∞ -*(a::Complex, ::InfiniteCardinal) = a * ∞ -*(a::InfiniteCardinal, b::Rational) = b*a -*(y::Infinity, a::Complex{Bool}) = ComplexInfinity(y)*a - -div(x::InfiniteCardinal, ::Rational) = x -div(x::Rational, ::InfiniteCardinal) = zero(x) - -cld(x::Rational, ::InfiniteCardinal) = signbit(x) ? zero(x) : one(x) -cld(x::InfiniteCardinal, ::Rational) = x - -fld(x::InfiniteCardinal, ::Rational) = x -fld(x::Rational, ::InfiniteCardinal) = signbit(x) ? -one(x) : zero(x) - -mod(::RealInfinity, ::InfiniteCardinal) = NotANumber() -mod(::InfiniteCardinal, ::Rational) = NotANumber() -function mod(x::Rational, ::InfiniteCardinal) - x ≥ 0 || throw(ArgumentError("mod(x,∞) is unbounded for x < 0")) - x -end - -==(x::Complex, y::RealInfinity) = y==x -==(x::AbstractIrrational, y::RealInfinity) = y==x -==(x::RealInfinity, y::AbstractIrrational) = isinf(y) && signbit(y) == signbit(x) -==(x::RealInfinity, y::Complex) = isinf(y) && signbit(y) == signbit(x) -==(::InfiniteCardinal, y::AbstractIrrational) = ∞ == y -==(::InfiniteCardinal, y::Rational) = ∞ == y -==(y::AbstractIrrational, x::Infinity) = x == y -==(x::AbstractIrrational, ::InfiniteCardinal) = x == ∞ -==(x::Rational, ::InfiniteCardinal) = x == ∞ -==(y::Complex, x::Infinity) = x == y -==(x::Infinity, y::Complex) = isinf(y) && angle(y) == angle(x) -==(x::Infinity, y::AbstractIrrational) = isinf(y) && angle(y) == angle(x) - -<(::InfiniteCardinal, ::Rational) = false -<(x::Rational, ::InfiniteCardinal) = true -<(x::Rational, ::InfiniteCardinal{0}) = x < ∞ - -≤(::InfiniteCardinal{0}, x::Rational) = ∞ ≤ x -≤(::InfiniteCardinal, x::Rational) = false -≤(x::Rational, ::InfiniteCardinal) = true - -isless(::InfiniteCardinal, ::InfiniteCardinal{0}) = false -isless(x::RealInfinity, y::ComplexInfinity{Bool}) = signbit(x) && y ≠ -∞ - -checked_sub(::InfiniteCardinal{0}, ::InfiniteCardinal{0}) = NotANumber() - -checked_mul(::InfiniteCardinal{0}, ::InfiniteCardinal{0}) = ℵ₀ - -end # module \ No newline at end of file