JuliaStaging / JuliaStaging/GeneralizedGenerated.jl

Issues with mk_function Typeable trait and blocks

Open
#18 6 comments 0 reactions 1 assignee Claimed by @thautwarm View on GitHub
bug
Dominant language
Julia
Stars
89
Forks
12
PR merge metrics
No merged PRs in 30d

Description

These were working with the older `mk_function` before the registration occurred:

```julia
oop_ex = quote
function func(u, p, t)
X = let (x, y, z, σ, ρ, β) = (u[1], u[2], u[3], p[1], p[2], p[3])
((*)(σ, (-)(y, x)), (-)((*)(x, (-)(ρ, z)), y), (-)((*)(x, y), (*)(β, z)))
end
T = promote_type(map(typeof, X)...)
convert.(T, X)
construct = if u isa (ModelingToolkit.StaticArrays).StaticArray
(ModelingToolkit.StaticArrays).similar_type(typeof(u), eltype(X))
else
x->begin
du = similar(u, T, 3)
vec(du) .= x
du
end
end
construct(X)
end
end
iip_ex = quote
function (A, u, p, t)
let (x, y, z, σ, ρ, β) = (u[1], u[2], u[3], p[1], p[2], p[3])
A[1] = (*)(σ, (-)(y, x))
A[2] = (-)((*)(x, (-)(ρ, z)), y)
A[3] = (-)((*)(x, y), (*)(β, z))
end
nothing
end
end
using GeneralizedGenerated
GeneralizedGenerated.mk_function(oop_ex)
GeneralizedGenerated.mk_function(iip_ex)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.