-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
numargs
fails for a function with explicit generic (and constrained) arguments
#55
Comments
Huh, thanks for catching this. I am not currently aware of a solution though... you can pass @ScottPJones do you know how to handle this at all? |
Ahh yes, thanks @mauro3. Just noticed julia> first(methods(lz1)).sig
Tuple{#lz1,T,Array{T,1},Array{T,1}} where T<:Real
julia> typeof(first(methods(lz1)).sig)
UnionAll
julia> fieldnames(first(methods(lz1)).sig)
2-element Array{Int64,1}:
1
2
julia> first(methods(lz1)).sig
Tuple{#lz1,T,Array{T,1},Array{T,1}} where T<:Real
julia> first(methods(lz1)).sig.1
ERROR: syntax: extra token "0.1" after end of expression
julia> first(methods(lz1)).sig.2
ERROR: syntax: extra token "0.2" after end of expression It seems rather peculiar. |
@ChrisRackauckas I am on the master branch of function lz(t, u, p, du)
σ, ρ, β = p
du[1] = σ*(u[2]-u[1])
du[2] = u[1]*(ρ-u[3]) - u[2]
du[3] = u[1]*u[2] - β*u[3]
end
flz = ParameterizedFunction(lz, (10.0, 28.0, 8/3.0),iip=true)
and the error with the elaborate typing happens, in this case, at the call to |
Just confirmed that the latest example works on DiffEqBase master. So you can manually add |
@mobius-eng note that on the current DiffEqBase.jl that syntax changes to: flz = ParameterizedFunction{true}(lz, (10.0, 28.0, 8/3.0)) All of the constructors which have to deal with inplace vs not-in-place have this setup now. It'll get documented ASAP. The advantage is that this is an inferrable way to specify it. Additionally, length(Base.unwrap_unionall(Tuple{T,T,T2} where {T,T2}).parameters) works. So that means length(Base.unwrap_unionall(first(methods(lz1)).sig).parameters) will work for your case. Using this your original issue is now fixed on master. function equation!{T<:Real, U , V}(t:: T, s :: Vector{T}, d :: U, Ds :: Vector{V}) end
ParameterizedFunction(equation!, [0.5]) I'll tag this soon. |
I have a function with explicitly stated constrained generic arguments:
Creating a parameterized function as
ParameterizedFunction(equation!, d)
Results in error in
numargs
(utils.jl
) function that seems unable to calculate correctly the number of arguments of such a generic function. The problem is in the callwhere
m
is a method ofequation!
: there is no fieldparameters
for my function.For something simpler it works:
However the change to explicit argument type results in error:
The text was updated successfully, but these errors were encountered: