-
Notifications
You must be signed in to change notification settings - Fork 114
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
@register
does not work for arrays variables or arrays of variables
#402
Comments
@YingboMa would this issue be a suitable first step towards better array-variable register support? An example usecase could be a dynamics function on the form function f(u, p, t)
# heavy computation
return du
end where @register f(u::Vector, p, t::Real)::Vector but with additional size information. The intended effect of calling FunctionCall{typeof(f)}((u, p, t), arg_types, return_type) that can later be extended with derivative/sparsity information etc. |
FYI, there's JuliaSymbolics/Symbolics.jl#457. But it seems to be slightly buggy. julia> @register_symbolic oof(x::AbstractVector)
julia> @variables x[1:100]
1-element Vector{Symbolics.Arr{Num, 1}}:
x[1:100]
julia> oof(x)
ERROR: MethodError: no method matching oof(::Symbolics.Arr{Num, 1})
Closest candidates are:
oof(::SymbolicUtils.Symbolic{<:AbstractVector}) at ~/src/julia/Symbolics/src/register.jl:51
Stacktrace:
[1] top-level scope
@ REPL[313]:1
julia> oof(Symbolics.unwrap(x))
oof(x) @shashi could you take a look? |
JuliaSymbolics/Symbolics.jl#557 fixes it. |
I cannot get
@register
to work with arrays of variables.I have found one workaround, which is to define a wrapper function that accepts a symbolic dummy variable, like so
but this is of course not optimal :)
Changing
Vector{Num}
todoesn't change anything
The text was updated successfully, but these errors were encountered: