-
-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Nowadays ForwardDiff seems to work nicely when using Complex (internally, at least), so I was trying to use dualcache with a complex array. Unfortunately, it seems like the more interesting methods of get_tmp base the returned eltype on the type of u (which is always some kind of Real) rather than on the type underlying the DiffCache. I wonder if it might be possible to generalize that.
It is possible to work around this by constructing the cache as zd = dualcache(reinterpret(reshape, T, z)) and then unpacking it inside the function as
ztmp = get_tmp(zd, t)
z = reinterpret(reshape, Complex{eltype(z)}, ztmp)Obviously, this is ugly, as well as hard to remember to do. I've fallen into this trap a few times, getting weird error messages far from the source of the problem. Automatic handling of Complex would really make things nicer for me. :)