Skip to content

Commit e0de41f

Browse files
authored
Use IntervalContractors.jl for reverse functions (#91)
* Replace reverse_mode.jl with using IntervalContractors package * Make alias for unexported rev_ops * Remove reverse_mode.jl * Rename rev_ops -> reverse_operations * Add IntervalContractors to REQUIRE
1 parent 20b6d50 commit e0de41f

File tree

6 files changed

+7
-140
lines changed

6 files changed

+7
-140
lines changed

REQUIRE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
julia 0.5
22
IntervalArithmetic 0.9
33
IntervalRootFinding 0.1
4+
IntervalContractors 0.1
45
MacroTools 0.3
56

src/IntervalConstraintProgramming.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ __precompile__()
22

33
module IntervalConstraintProgramming
44

5-
using IntervalArithmetic, IntervalRootFinding
5+
using IntervalArithmetic,
6+
IntervalRootFinding,
7+
IntervalContractors
68

79
using MacroTools
810

@@ -20,8 +22,8 @@ export
2022
Vol,
2123
show_code
2224

25+
const reverse_operations = IntervalContractors.reverse_operations
2326

24-
include("reverse_mode.jl")
2527
include("ast.jl")
2628
include("code_generation.jl")
2729
include("contractor.jl")

src/ast.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ function process_call!(flatAST::FlatAST, ex, new_var=nothing)
309309

310310
#@show op
311311

312-
if op keys(rev_ops) # standard operator
312+
if op keys(reverse_operations) # standard operator
313313
if new_var == nothing
314314
new_var = make_symbol()
315315
end

src/code_generation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function emit_backward_code(a::Assignment)
5353
args = isa(a.args, Vector) ? a.args : [a.args]
5454

5555
return_args = [a.lhs, args...]
56-
rev_op = rev_ops[a.op] # find reverse operation
56+
rev_op = reverse_operations[a.op] # find reverse operation
5757

5858
if rev_op == :() # empty
5959
args = make_tuple(args)

src/reverse_mode.jl

Lines changed: 0 additions & 130 deletions
This file was deleted.

test/runtests.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,3 @@ end
163163

164164
@test C3(A, x) == IntervalBox(sqrt(A / 16))
165165
end
166-
167-
@testset "power_rev for odd power" begin
168-
x = -..
169-
a = -8..27
170-
power_rev(a, x, 3)[2] == Interval(-2.0000000000000004, 3.0000000000000004)
171-
end

0 commit comments

Comments
 (0)