Skip to content

Commit 9369d68

Browse files
authored
Merge pull request #283 from JuliaReach/schillic/pow
Fix `pow`/`pown` error
2 parents e539635 + b7d120e commit 9369d68

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/init_IntervalArithmetic.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ else # vIA < v"0.22"
2121

2222
intersect_interval(a::Interval, b::Interval) = intersect(a, b)
2323

24+
pown(x, y) = x^y
25+
2426
if vIA >= v"0.21"
2527
# `convert` was temporarily removed in IntervalArithmetic v0.21 until v0.22
2628
Base.convert(::Type{Interval{T}}, x::Number) where {T} = interval(T(x))

src/operations/arithmetic.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function square(A::IntervalMatrix)
8383

8484
# case i == j
8585
@inbounds for j in 1:n
86-
B[j, j] = pow(A[j, j], 2)
86+
B[j, j] = pown(A[j, j], 2)
8787
for k in 1:n
8888
k == j && continue
8989
B[j, j] += A[j, k] * A[k, j]

test/exponential.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ end
6060
a = m * m
6161
b = square(m)
6262
@test b a
63+
64+
# correct use of `pown` (#283)
65+
m = IntervalMatrix(hcat(interval(-4.0, -2.0)))
66+
@test square(m) IntervalMatrix(hcat(interval(4.0, 16.0)))
6367
end
6468

6569
@testset "Interval matrix power" begin

0 commit comments

Comments
 (0)