Skip to content

Commit

Permalink
handle nonlinear system in linearized codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed Oct 19, 2023
1 parent 39d4ee3 commit cd33d45
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,17 @@ That's pretty cool, but even nicer is to generate some code for this symbolic sy

```@example LINEAIZE_SYMBOLIC
defs = ModelingToolkit.defaults(simplified_sys)
_, pars = ModelingToolkit.get_u0_p(simplified_sys, defs, defs)
x, pars = ModelingToolkit.get_u0_p(simplified_sys, defs, defs)
fun = Symbolics.build_function(symbolic_sys, ModelingToolkit.parameters(simplified_sys); expression=Val{false}, force_SA=true)
fun = Symbolics.build_function(symbolic_sys, states(simplified_sys), ModelingToolkit.parameters(simplified_sys); expression=Val{false}, force_SA=true)
static_lsys = fun(pars)
static_lsys = fun(x, pars)
```
It's pretty fast
```julia
@btime $fun($pars)
9.548 ns (0 allocations: 0 bytes)
using BenchmarkTools
@btime $fun($x, $pars)
8.484 ns (0 allocations: 0 bytes)
```
faster than multiplying two integers in python.

Expand Down

0 comments on commit cd33d45

Please sign in to comment.