Skip to content

Conversation

baggepinnen
Copy link
Contributor

Useful for nonlinear control-systems analysis and design

Copy link
Contributor

github-actions bot commented Sep 2, 2025

Benchmark Results (Julia vlts)

Time benchmarks
master 9cbca5f... master / 9cbca5f...
ODEProblem 0.0808 ± 0.0054 s 0.0797 ± 0.0062 s 1.01 ± 0.1
init 0.0578 ± 0.0014 ms 0.0573 ± 0.0015 ms 1.01 ± 0.036
large_parameter_init/ODEProblem 1.06 ± 0.0047 s 1.05 ± 0.0093 s 1.01 ± 0.01
large_parameter_init/init 0.107 ± 0.0019 ms 0.108 ± 0.0019 ms 0.992 ± 0.025
mtkcompile 0.0344 ± 0.00048 s 0.0336 ± 0.00063 s 1.02 ± 0.024
time_to_load 4.77 ± 0.026 s 4.78 ± 0.036 s 0.999 ± 0.0093
Memory benchmarks
master 9cbca5f... master / 9cbca5f...
ODEProblem 0.587 M allocs: 19.9 MB 0.587 M allocs: 19.9 MB 0.999
init 0.892 k allocs: 0.0463 MB 0.892 k allocs: 0.0463 MB 1
large_parameter_init/ODEProblem 4.3 M allocs: 0.166 GB 4.32 M allocs: 0.168 GB 0.992
large_parameter_init/init 1.74 k allocs: 0.0858 MB 1.74 k allocs: 0.0858 MB 1
mtkcompile 0.237 M allocs: 8.75 MB 0.237 M allocs: 8.75 MB 1
time_to_load 0.153 k allocs: 14.5 kB 0.153 k allocs: 14.5 kB 1

Copy link
Contributor

github-actions bot commented Sep 2, 2025

Benchmark Results (Julia v1)

Time benchmarks
master 9cbca5f... master / 9cbca5f...
ODEProblem 0.0804 ± 0.0056 s 0.0802 ± 0.0042 s 1 ± 0.087
init 0.0543 ± 0.011 ms 0.054 ± 0.011 ms 1.01 ± 0.3
large_parameter_init/ODEProblem 1.09 ± 0.023 s 1.08 ± 0.029 s 1.01 ± 0.035
large_parameter_init/init 0.0981 ± 0.01 ms 0.0981 ± 0.011 ms 1 ± 0.15
mtkcompile 0.0356 ± 0.0019 s 0.0351 ± 0.0013 s 1.02 ± 0.067
time_to_load 5.06 ± 0.019 s 5.05 ± 0.064 s 1 ± 0.013
Memory benchmarks
master 9cbca5f... master / 9cbca5f...
ODEProblem 0.576 M allocs: 18.7 MB 0.578 M allocs: 18.7 MB 0.998
init 0.799 k allocs: 30.9 kB 0.799 k allocs: 30.9 kB 1
large_parameter_init/ODEProblem 4.42 M allocs: 0.161 GB 4.4 M allocs: 0.16 GB 1.01
large_parameter_init/init 1.65 k allocs: 0.0696 MB 1.65 k allocs: 0.0696 MB 1
mtkcompile 0.236 M allocs: 8.17 MB 0.236 M allocs: 8.18 MB 0.999
time_to_load 0.159 k allocs: 11.2 kB 0.159 k allocs: 11.2 kB 1

@baggepinnen baggepinnen changed the title add input-affine equation factorization add input-affine equation decomposition Sep 3, 2025
"""
function input_affine_form(eqs, inputs)
# Extract the input matrix g(x) by taking coefficients of each input
g = [Symbolics.coeff(Symbolics.simplify(eq, expand = true), u)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplify and especially expand are pretty expensive. This should ideally be done with semilinear_form or repeated application of Symbolics.linear_expansion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semilinear_form appeared to be buggy and not doing what I wanted
https://juliahub.slack.com/archives/C03UEC0P6G0/p1756812154880999

linear_expansion has this issue

help?> Symbolics.linear_expansion
  │ Warning
  │
  │  The following bindings may be internal; they may change or be removed in future versions:
  │
  │    •  Symbolics.linear_expansion

and it has failed to work for me in similar situations in the past JuliaSymbolics/Symbolics.jl#550

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can look into semilinear_form. The linked linear_expansion issue is simply that the expression was not affine. That isn't the case if this function requires the system to be affine in the inputs.

ChrisRackauckas-Claude pushed a commit to ChrisRackauckas-Claude/ModelingToolkit.jl that referenced this pull request Sep 3, 2025
Adds explicit DiffEqBase import to resolve UndefVarError that occurs
when running tests in SafeTestsets environment. The error manifested
in CI at line 70 where DiffEqBase.ODEFunction is called but DiffEqBase
was not directly imported, only available through transitive dependencies.

Fixes CI failure in PR SciML#3912 InterfaceI test group.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants