Issue with PDMP and Forwardiff - DifferentialEquation



I repost here an issue posted in DifferentialEquations because I am not sure this issue concerns them entirely.

In the following example, Forwardiff which is called from Rosenbrock23() fails. I spent quite some time to debug it. Please note that Forwardiff works with PDMP.jl. An example is the here.

Hence, I am a bit stuck here. Maybe some of you have an idea.

thank you for your help,

using PDMP, LinearAlgebra, Random, DifferentialEquations

function F_fd!(ẋ, xc, xd, t, parms)
    # vector field used for the continuous variable
    if mod(xd[1],2)==0
        ẋ[1] = 1 + xd[1]
        ẋ[1] = -1

rate_tcp(x) = 1/x

function R_fd!(rate, xc, xd, t, parms, sum_rate::Bool)
#replacing xc[1] -> xd[1] in the next line removes the error
    rate[1] = rate_tcp(xc[1]) * xd[1]
    rate[2] = 0.0
    if sum_rate==false
        return 0., 0.
        return sum(rate), 0.

xc0 = [ 1.0 ]
xd0 = [1, 1]

nu_fd = [[1 0];[0 -1]]
parms = [0.0]

# works:
res =  @time PDMP.pdmp!(xc0, xd0, F_fd!, R_fd!, nu_fd, parms, 0.0, 1.0, n_jumps = 3,   ode = Tsit5())
# fail because of autodiff
res =  @time PDMP.pdmp!(xc0, xd0, F_fd!, R_fd!, nu_fd, parms, 0.0, 1.0, n_jumps = 3,   ode = Rosenbrock23())

The error is the following:

ERROR: LoadError: MethodError: no method matching Float64(::ForwardDiff.Dual{ForwardDiff.Tag{DiffEqDiffTools.UJacobianWrapper{ODEFunction{true,getfield(PDMP, Symbol("##31#33")){PDMP.PDMPProblem{Float64,Int64,Array{Float64,1},Array{Int64,1},Array{Int64,2},Array{Float64,1},typeof(F_fd!),typeof(R_fd!),typeof(PDMP.Delta_dummy)}},UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Nothing},Float64},Float64,2})
Closest candidates are:
  Float64(::Real, ::RoundingMode) where T<:AbstractFloat at rounding.jl:185
  Float64(::T<:Number) where T<:Number at boot.jl:725
  Float64(::Int8) at float.jl:60