Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex pullback support #22

Open
sethaxen opened this issue Oct 11, 2021 · 4 comments · May be fixed by #23
Open

Complex pullback support #22

sethaxen opened this issue Oct 11, 2021 · 4 comments · May be fixed by #23
Labels
feature New feature or request

Comments

@sethaxen
Copy link
Member

I realized that if the _dot function introduced in #21 is wrapped with real, then pullback_function works for complex arrays as well, whenever gradient supports complex inputs for a given backend. But at least in the scalar case, the real dot product can be computed twice as efficiently as real(_dot(x, y)).

@sethaxen
Copy link
Member Author

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.

@mohamed82008
Copy link
Member

I agree. Even Jacobians can be supported as long as either the inputs or outputs are real.

@sethaxen
Copy link
Member Author

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.

@mohamed82008
Copy link
Member

ya complex input and output is messy, let's stick to the simple cases

@sethaxen sethaxen linked a pull request Oct 12, 2021 that will close this issue
@gdalle gdalle added the feature New feature or request label Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants