Skip to content

Commit 6ea1cd8

Browse files
yashvardhan747dpsanders
authored andcommitted
Do not sort variables by name (#146)
* Variable are not sorting by names * DS_store removed * Added test
1 parent c60a5df commit 6ea1cd8

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/ast.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ end
6262
# Close to single assignment form
6363
mutable struct FlatAST
6464
top # topmost variable(s)
65-
input_variables::Set{Symbol}
65+
input_variables::Vector{Symbol}
6666
intermediate::Vector{Symbol} # generated vars
6767
code # ::Vector{Assignment}
6868
variables::Vector{Symbol} # cleaned version of input_variables
@@ -76,7 +76,7 @@ function Base.show(io::IO, flatAST::FlatAST)
7676
println(io, "code: ", flatAST.code)
7777
end
7878

79-
FlatAST() = FlatAST([], Set{Symbol}(), [], [], [])
79+
FlatAST() = FlatAST([], [], [], [], [])
8080

8181
export FlatAST
8282

src/code_generation.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ function forward_backward(flatAST::FlatAST)
133133

134134
# @show flatAST.input_variables
135135
# @show flatAST.intermediate
136-
137-
138-
input = sort(collect(flatAST.input_variables))
136+
input = collect(flatAST.input_variables)
139137

140138
# @show flatAST.top
141139

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ end
6565
C2 = Contractor([x, y, z], y+z)
6666
@test C2(A,X) == IntervalBox(0.5..1.5, 0.5..0.5, 0.5..0.5)
6767

68+
vars = @variables x1 x3 x2
69+
70+
C = Contractor(vars, x1+x2)
71+
@test C(A, X) == IntervalBox(0.5..0.5, 0.5..1.5, 0.5..0.5)
72+
6873
end
6974

7075
@testset "Contractor is created by function name " begin

0 commit comments

Comments
 (0)