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

Update adjoint of Linear Solve for complex matrices #582

Merged
merged 9 commits into from
Mar 6, 2025

Conversation

cmrace
Copy link
Contributor

@cmrace cmrace commented Feb 17, 2025

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

For complex matrices, A \ b and LinearProblem(A, b) give different gradients via Zygote. The issue is that Zygote uses adjoint
while LinearSolve uses transpose. This should only affect behavior for complex matrices and this PR changes LinearSolve behavior to match Zygote.

@ChrisRackauckas
Copy link
Member

The tests fail because ForwardDiff cannot handle the complex numbers. It should split that part to keep real numbers in the test with FD

@ChrisRackauckas
Copy link
Member

Thanks for sticking with this!

@ChrisRackauckas ChrisRackauckas merged commit 9b2fe0e into SciML:main Mar 6, 2025
22 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants