Skip to content

Commit 8e671e2

Browse files
Merge pull request #302 from ArnoStrouwen/patch-2
update NonlinearSystem docs
2 parents 2bdfe15 + e39bdbc commit 8e671e2

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

docs/src/highlevel.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ function to be used from within the same world-age, one simply needs to pass `Va
181181
generate the function, i.e.:
182182

183183
```julia
184-
nlsys_func = generate_function(ns, [x,y,z], [σ,ρ,β], Val{false})[2]
184+
nlsys_func = generate_function(ns, [x,y,z], [σ,ρ,β], expression=Val{false})[2]
185185
```
186186

187187
which uses GeneralizedGenerated.jl to build a same world-age function on the fly without eval.
@@ -330,19 +330,22 @@ a = y - x
330330
eqs = [0 ~ σ*a,
331331
0 ~ x*-z)-y,
332332
0 ~ x*y - β*z]
333-
ns = NonlinearSystem(eqs, [x,y,z])
334-
nlsys_func = generate_function(ns, [x,y,z], [σ,ρ,β])
333+
ns = NonlinearSystem(eqs, [x,y,z], [σ,ρ,β])
334+
nlsys_func = generate_function(ns)[2] # second is the inplace version
335335
```
336336

337337
expands to:
338338

339339
```julia
340-
:((##365, u, p)->begin
341-
let (x, y, z, σ, ρ, β) = (u[1], u[2], u[3], p[1], p[2], p[3])
342-
##365[1] = σ * (y - x)
343-
##365[2] = x * (ρ - z) - y
344-
##365[3] = x * y - β * z
345-
end
340+
:((var"##MTIIPVar#368", var"##MTKArg#365", var"##MTKArg#366")->begin
341+
@inbounds begin
342+
let (x, y, z, σ, ρ, β) = (var"##MTKArg#365"[1], var"##MTKArg#365"[2], var"##MTKArg#365"[3], var"##MTKArg#366"[1], var"##MTKArg#366"[2], var"##MTKArg#366"[3])
343+
var"##MTIIPVar#368"[1] = (*)(σ, (-)(y, x))
344+
var"##MTIIPVar#368"[2] = (-)((*)(x, (-)(ρ, z)), y)
345+
var"##MTIIPVar#368"[3] = (-)((*)(x, y), (*)(β, z))
346+
end
347+
end
348+
nothing
346349
end)
347350
```
348351

0 commit comments

Comments
 (0)