QuadGK.jl
QuadGK.jl copied to clipboard
MethodError: no method matching kronrod(::Type{ForwardDiff.Dual{ForwardDiff.Tag{typeof(test), Float64}, Float64, 1}}, ::Int64)
See https://github.com/JuliaMath/QuadGK.jl/issues/13#issuecomment-1430408697
A workaround is probably to define:
QuadGK.cachedrule(::Type{<:ForwardDiff{<:Any, T}}, n::Integer) where {T<:Number} =
QuadGK._cachedrule(typeof(float(real(one(T)))), Int(n))
I recently had the same issue with a package of mine. I solved it by including the lines
import QuadGK: kronrod
QuadGK.kronrod(::Type{<:ForwardDiff.Dual{T,V,N}}, n::Integer) where {T,V,N} = QuadGK.kronrod(V, n)
Now, this is still a work around, from the little I read today, it seems to me an issue that should be solved within ForwardDiff.jl.
I'm not familiar with the inner code of QuadGK, tbh, so this might be totaly equivalent to @stevengj solution. I went this way because the error was complaining of krondor().