Skip to content

Commit b87a2cd

Browse files
committed
Update tests
1 parent fc51f56 commit b87a2cd

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

src/systems/alias_elimination.jl

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ function alias_elimination!(state::TearingState)
108108

109109
lineqs = BitSet(old_to_new[e] for e in mm.nzrows)
110110
for (ieq, eq) in enumerate(eqs)
111-
# TODO: fix this
112111
ieq in lineqs && continue
113112
eqs[ieq] = substitute(eq, subs)
114113
end
@@ -275,14 +274,6 @@ function Base.in(i::Int, agk::AliasGraphKeySet)
275274
1 <= i <= length(aliasto) && aliasto[i] !== nothing
276275
end
277276

278-
function reduce!(mm::SparseMatrixCLIL, ag::AliasGraph)
279-
for i in 1:size(mm, 1)
280-
adj_row = @view mm[i, :]
281-
locally_structure_simplify!(adj_row, nothing, ag)
282-
end
283-
mm
284-
end
285-
286277
function equality_diff_graph(ag::AliasGraph, var_to_diff::DiffGraph)
287278
g = SimpleDiGraph{Int}(length(var_to_diff))
288279
eqg = SimpleWeightedGraph{Int, Int}(length(var_to_diff))
@@ -484,7 +475,7 @@ function do_bareiss!(M, Mold, is_linear_variables)
484475
end
485476
end
486477
bareiss_ops = ((M, i, j) -> nothing, myswaprows!,
487-
bareiss_update_virtual_colswap_mtk!, bareiss_zero!)
478+
bareiss_update_virtual_colswap_mtk!, bareiss_zero!)
488479
rank2, = bareiss!(M, bareiss_ops; find_pivot = find_and_record_pivot)
489480
rank1 = something(rank1r[], rank2)
490481
(rank1, rank2, pivots)
@@ -531,7 +522,9 @@ function reduce!(mm, mm_orig, ag, rank2, pivots = nothing)
531522
end
532523

533524
function simple_aliases!(ag, graph, var_to_diff, mm_orig)
534-
echelon_mm, solvable_variables, (rank1, rank2, pivots) = aag_bareiss!(graph, var_to_diff, mm_orig)
525+
echelon_mm, solvable_variables, (rank1, rank2, pivots) = aag_bareiss!(graph,
526+
var_to_diff,
527+
mm_orig)
535528

536529
# Step 2: Simplify the system using the Bareiss factorization
537530
rk1vars = BitSet(@view pivots[1:rank1])

test/reduction.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,9 @@ eqs = [x ~ 0
285285
a ~ b + y]
286286
@named sys = ODESystem(eqs, t, [x, y, a, b], [])
287287
ss = alias_elimination(sys)
288-
@test equations(ss) == [0 ~ b - a]
289-
@test sort(observed(ss), by = string) == ([D(x), x, y] .~ 0)
288+
# a and b will be set to 0
289+
@test isempty(equations(ss))
290+
@test sort(observed(ss), by = string) == ([D(x), a, b, x, y] .~ 0)
290291

291292
eqs = [x ~ 0
292293
D(x) ~ x + y]

0 commit comments

Comments
 (0)