Open sethaxen opened 2 years ago
Not certain if this package wants to support complex AD (with Jacobians as the primitive, complex support is a little awkward), but to me it seems like, if the AD supports complex numbers, then at least for pushforwards, pullbacks, and gradients, it'd be nice if we did too.
I agree. Even Jacobians can be supported as long as either the inputs or outputs are real.
That's right, and even with both complex inputs and outputs, it can be supported by interleaving the real and imaginary parts into one real vector, but having the eltype be dependent on the real-ness of input and output starts to feel messy.
ya complex input and output is messy, let's stick to the simple cases
I realized that if the
_dot
function introduced in #21 is wrapped withreal
, thenpullback_function
works for complex arrays as well, whenevergradient
supports complex inputs for a given backend. But at least in the scalar case, the real dot product can be computed twice as efficiently asreal(_dot(x, y))
.