Hi Chris,
Thank you for your reply! Num appears to solve some type-related issue, but since it wraps all subtypes of Real, converting Num to Float64 is not permitted. My understanding can be quite superficial, and I’m curious about the root cause of this issue.
I found a workaround by duplicating the data with the field types being Num. The code below is my workaround, and that is no where close to an ideal solution.
import PreallocationTools: get_tmp
get_tmp(dc::PreallocationTools.DiffCache, u::AbstractArray{T} where T<:Num) = dc.du;
dae_cache_num = GlobalDAE(dualcache(Num[0., 0.]), dualcache(Num[0., 0.]));
x0_num = Num[1., 2.];
output_num = similar(x0);
wrap_res_dae_cache_num! = (output, x0) -> res_dae_cache!(dae_cache_num, output, x0)
Symbolics.jacobian_sparsity(wrap_res_dae_cache_num!, output_num, x0_num)
I will open an issue next.