Skip to content

update NonlinearSystem docs #302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions docs/src/highlevel.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function to be used from within the same world-age, one simply needs to pass `Va
generate the function, i.e.:

```julia
nlsys_func = generate_function(ns, [x,y,z], [σ,ρ,β], Val{false})[2]
nlsys_func = generate_function(ns, [x,y,z], [σ,ρ,β], expression=Val{false})[2]
```

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

expands to:

```julia
:((##365, u, p)->begin
let (x, y, z, σ, ρ, β) = (u[1], u[2], u[3], p[1], p[2], p[3])
##365[1] = σ * (y - x)
##365[2] = x * (ρ - z) - y
##365[3] = x * y - β * z
end
:((var"##MTIIPVar#368", var"##MTKArg#365", var"##MTKArg#366")->begin
@inbounds begin
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])
var"##MTIIPVar#368"[1] = (*)(σ, (-)(y, x))
var"##MTIIPVar#368"[2] = (-)((*)(x, (-)(ρ, z)), y)
var"##MTIIPVar#368"[3] = (-)((*)(x, y), (*)(β, z))
end
end
nothing
end)
```

Expand Down