diff --git a/docs/src/lib/methods.md b/docs/src/lib/methods.md index 6033588..361032b 100644 --- a/docs/src/lib/methods.md +++ b/docs/src/lib/methods.md @@ -19,7 +19,7 @@ sup mid diam radius -midpoint_radius +midradius rand sample ∈ diff --git a/src/init_IntervalArithmetic.jl b/src/init_IntervalArithmetic.jl index 8c4e3de..5aa2aa0 100644 --- a/src/init_IntervalArithmetic.jl +++ b/src/init_IntervalArithmetic.jl @@ -8,12 +8,18 @@ else vIA = PkgVersion.Version(IntervalArithmetic) end +@static if vIA >= v"0.21.2" + import IntervalArithmetic: midradius +else + export midradius +end + @static if vIA >= v"0.22" import Base: intersect - export ±, midpoint_radius # not exported by IntervalArithmetic anymore + export ± # not exported by IntervalArithmetic anymore else # vIA < v"0.22" # COV_EXCL_START - import IntervalArithmetic: ±, midpoint_radius + import IntervalArithmetic: ± issubset_interval(x::Interval, y::Interval) = issubset(x, y) diff --git a/src/operations/numops.jl b/src/operations/numops.jl index 58474f3..021192a 100644 --- a/src/operations/numops.jl +++ b/src/operations/numops.jl @@ -89,7 +89,7 @@ function diam(A::IntervalMatrix{T}) where {T} end """ - midpoint_radius(A::IntervalMatrix{T}) where {T} + midradius(A::IntervalMatrix{T}) where {T} Split an interval matrix ``A`` into two scalar matrices ``C`` and ``S`` such that ``A = C + [-S, S]``. @@ -103,7 +103,7 @@ such that ``A = C + [-S, S]``. A pair `(C, S)` such that the entries of `C` are the central points and the entries of `S` are the (nonnegative) radii of the intervals in `A`. """ -midpoint_radius(A::IntervalMatrix) = (mid(A), radius(A)) +midradius(A::IntervalMatrix) = (mid(A), radius(A)) real(M::IntervalMatrix) = IntervalMatrix(real(M.mat)) imag(M::IntervalMatrix) = IntervalMatrix(imag(M.mat)) diff --git a/test/constructors.jl b/test/constructors.jl index 41e944a..6a12656 100644 --- a/test/constructors.jl +++ b/test/constructors.jl @@ -18,10 +18,10 @@ @test A ± B == IntervalMatrix([interval(0, 2) interval(0, 4); interval(-1, 7) interval(-1, 9)]) end -@testset "Interval matrix midpoint_radius" begin +@testset "Interval matrix midradius" begin m = IntervalMatrix([interval(-1.1, 0.9) interval(-4.1, -3.9); interval(3.9, 4.1) interval(-1.1, 0.9)]) - c, s = midpoint_radius(m) + c, s = midradius(m) @test c ≈ [-0.1 -4; 4 -0.1] @test s ≈ [1 0.1; 0.1 1] end