Skip to content

Commit 240119d

Browse files
fix: handle consts in find_eq_solvables!
1 parent 058024c commit 240119d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/structural_transformation/utils.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function find_eq_solvables!(state::TearingState, ieq, to_rm = Int[], coeffs = no
267267
a, b, islinear = linear_expansion(term, var)
268268

269269
islinear || (all_int_vars = false; continue)
270-
if a isa SymbolicT
270+
if !SU.isconst(a)
271271
all_int_vars = false
272272
if !allow_symbolic
273273
if allow_parameter
@@ -282,20 +282,20 @@ function find_eq_solvables!(state::TearingState, ieq, to_rm = Int[], coeffs = no
282282
add_edge!(solvable_graph, ieq, j)
283283
continue
284284
end
285-
if !(a isa Number)
285+
if !(symtype(a) <: Number)
286286
all_int_vars = false
287287
continue
288288
end
289289
# When the expression is linear with numeric `a`, then we can safely
290290
# only consider `b` for the following iterations.
291291
term = b
292-
if isone(abs(a))
293-
coeffs === nothing || push!(coeffs, convert(Int, a))
292+
if SU._isone(abs(a))
293+
coeffs === nothing || push!(coeffs, convert(Int, unwrap_const(a)))
294294
else
295295
all_int_vars = false
296296
conservative && continue
297297
end
298-
if a != 0
298+
if !SU._iszero(a)
299299
add_edge!(solvable_graph, ieq, j)
300300
else
301301
if may_be_zero

0 commit comments

Comments
 (0)