Skip to content

Commit 3811644

Browse files
fix: only use OffsetArray in array hack for non-standard firstindex
1 parent 1914b78 commit 3811644

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/structural_transformation/symbolics_tearing.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,11 @@ function cse_and_array_hacks(obs, subeqs, unknowns, neweqs; cse = true, array =
738738
# try to `create_array(OffsetArray{...}, ...)` which errors.
739739
# `term(Origin(firstind), scal)` doesn't retain the `symtype` and `size`
740740
# of `scal`.
741-
push!(obs_arr_eqs, arrvar ~ change_origin(Origin(firstind), scal))
741+
rhs = scal
742+
if !isone(firstind)
743+
rhs = change_origin(Origin(firstind), rhs)
744+
end
745+
push!(obs_arr_eqs, arrvar ~ rhs)
742746
end
743747
append!(obs, obs_arr_eqs)
744748
append!(subeqs, obs_arr_eqs)

0 commit comments

Comments
 (0)