Repository navigation
Conversation
The frule and rrule for `Matrix`/`Array` of a `Symmetric`/`Hermitian` now project with `ProjectTo(A)`, giving the natural tangent `(Δ + Δ')/2` instead of the structural one that double-counted off-diagonals. This matches FiniteDifferences 0.12.35, whose `to_vec(::Symmetric/Hermitian)` now yields natural tangents. Re-enables the `prod` tests on `Symmetric` (#475). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #856 +/- ##
==========================================
- Coverage 96.64% 96.63% -0.02%
==========================================
Files 28 28
Lines 3605 3594 -11
==========================================
- Hits 3484 3473 -11
Misses 121 121 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FiniteDifferences 0.12.35 (JuliaDiff/FiniteDifferences.jl#252, fixing JuliaDiff/FiniteDifferences.jl#164) changed
to_vec(::Symmetric/Hermitian)so finite differencing gives natural tangents(Δ + Δ')/2. Before, it gave structural tangents that counted the off-diagonals twice. TheMatrix(::HermOrSym)rules were written to match the old behaviour, so their tests fail with FD 0.12.35.This PR makes the
fruleandrruleforMatrix/Arrayof aSymmetric/Hermitianproject withProjectTo(A), which returns the natural tangent. That replaces the hand-written_symherm_forward/_symherm_backlogic in these rules. The_symmetric_back/_hermitian_backhelpers stay for theSymmetric(A, uplo)/Hermitian(A, uplo)constructor rrule, whose pullback is not a projection.uplodiffers from the primal's is handled by ChainRulesCore 1.26.6 (Handle Symmetric/Hermitian tangents with other uplo in ProjectTo ChainRulesCore.jl#721). Before that fix,ProjectTothrew on it. There is a new test for this case.prodtests onSymmetricthat were skipped in tests for rrule(prod, ::Symmetric) are disabled because they fail #475, and adds agetindextest onSymmetric.Closes #475. Unblocks #783.
🤖 Generated with Claude Code