Closed kiranshila closed 5 months ago
Looks like Julia's complex sqrt has a bit hack. We should just define a rule for it. That should fix it, but I don't myself have time for roughly a week before I can work on it.
If you or others are interested in adding it lmk.
Doing so properly requires writing the complex sqrt here (https://github.com/EnzymeAD/Enzyme/blob/0b621884bc531329095d202f042f6599a86614ec/enzyme/Enzyme/InstructionDerivatives.td#L834 this is the complex 1/z rule) and for Julia here (https://github.com/EnzymeAD/Enzyme.jl/blob/8784d1f79cf9e84028bc04c7455493d1b9dcbd31/src/compiler/interpreter.jl#L97) and here (https://github.com/EnzymeAD/Enzyme.jl/blob/8784d1f79cf9e84028bc04c7455493d1b9dcbd31/src/compiler.jl#L71)
Thank you for the quick reply! I'll hack on this a bit to see what I can do, although I'm a bit intimidated by Enzyme's internals. :)
If you're willing to document what is unclear as you do so, we unquestionable need more (both user and dev) docs.
That would be enormously helpful for a bunch of folks (even if it's just asking a bunch of questions and making PRs with the answers).
Fixed in #1324
Forgive me if this is a known issue, feel free to close if so. I see some stuff with complex numbers has been merged recently, so I tried this on main (8784d1f) with the same issue.
I'm trying to take the derivative of something like:
I know the derivative should be:
Trying
Gives
Which is an impressive amount of output, rivaling C++ template errors :)
Any help would be appreciated.