Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/lib/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ sup
mid
diam
radius
midpoint_radius
midradius
rand
sample
Expand Down
10 changes: 8 additions & 2 deletions src/init_IntervalArithmetic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions src/operations/numops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]``.
Expand All @@ -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))
4 changes: 2 additions & 2 deletions test/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading