Skip to content

mtkcompile's sort_eqs keyword argument doesn't do anything #3975

@MasonProtter

Description

@MasonProtter

Describe the bug 🐞

MTK will lexographically sort equations whether or not the sort_eqs kwarg is provided to mtkcompile.

Expected behavior

A clear and concise description of what you expected to happen.

Minimal Reproducible Example 👇

using ModelingToolkit
using ModelingToolkit: t_nounits as t, D_nounits as D

With sorting enabled:

julia> let sort_eqs=true
           @variables x(t) y(t) z(t)
           eqs = [
               D(x) ~ y
               D(z) ~ x
               D(y) ~ z
           ]
           @named sys = System(eqs, t)
           sys_comp = mtkcompile(sys; sort_eqs)
           equations(sys_comp)
       end
3-element Vector{Equation}:
 Differential(t)(y(t)) ~ z(t)
 Differential(t)(z(t)) ~ x(t)
 Differential(t)(x(t)) ~ y(t)

With sorting 'disabled'

julia> let sort_eqs=false
           @variables x(t) y(t) z(t)
           eqs = [
               D(x) ~ y
               D(z) ~ x
               D(y) ~ z
           ]
           @named sys = System(eqs, t)
           sys_comp = mtkcompile(sys; sort_eqs)
           equations(sys_comp)
       end
3-element Vector{Equation}:
 Differential(t)(y(t)) ~ z(t)
 Differential(t)(z(t)) ~ x(t)
 Differential(t)(x(t)) ~ y(t)

Note that there is no difference.

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
(jl_kKdqv9) pkg> st
Status `/tmp/jl_kKdqv9/Project.toml`
  [961ee093] ModelingToolkit v10.26.0
  [789caeaf] StochasticDiffEq v6.83.0

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions