Repository navigation
Take the inverse as the adjugate over the determinant - #2353
Merged
Rafael-SOWNet merged 1 commit intoNov 3, 2026
Merged
Conversation
The inverse was GenericTensor's, which takes the determinant by elimination: it divides by the first pivot and multiplies it back, so the determinant of [[a, b], [c, d]] came to a * (d * a + -c * b) / a, and simplifying its a / a wrote "provided not a = 0" on every entry of the inverse. The rotation's carried cos t != 0. Each inverse exists wherever the determinant is not 0, a = 0 and t = pi/2 included, and at pi/2 the rotation's is [[0, 1], [-1, 0]]. 2.6.0 does the same. The inverse is the matrix's own Adjugate over its own Determinant, entry by entry: the determinant is a polynomial in the entries, Bareiss' or Laplace's, and the adjugate's entries are cofactors, so nothing divides but the one division by the determinant, whose condition is the inverse's own. A matrix of numbers has the inverse it had, and matrixcheck's A A^-1 = I is clean on 1200 random matrices. GenTensorGuard's InvertMatrix had no caller left and is removed. Closes #2346 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2353 +/- ##
==========================================
- Coverage 86.79% 86.78% -0.01%
==========================================
Files 312 312
Lines 68709 68727 +18
Branches 20006 20014 +8
==========================================
+ Hits 59637 59647 +10
- Misses 4904 4907 +3
- Partials 4168 4173 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Rafael-SOWNet
deleted the
an-inverse-is-the-adjugate-over-the-determinant
branch
November 3, 2026 17:14
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.
Closes #2346.
[[a, b], [c, d]].Inverse.Simplify()… provided not a = 0[[d / (a * d - b * c), -b / (a * d - b * c)], [-c / (a * d - b * c), a / (a * d - b * c)]][[cos(t), -sin(t)], [sin(t), cos(t)]].Inverse.Simplify()[[cos(t), sin(t) provided not cos(t) = 0], [-sin(t) provided not cos(t) = 0, cos(t)]][[cos(t), sin(t)], [-sin(t), cos(t)]]t = π/2, evaluatedNaN[[0, 1], [-1, 0]]The inverse was GenericTensor's
InvertMatrix. That takes the determinant by elimination, which divides by the first pivot and multiplies it back, so the determinant came toa * (d * a + -c * b) / a, and simplifying itsa / awrote the pivot's condition on every entry. As the issue suggests, the inverse is now the matrix's ownAdjugateover its ownDeterminant, entry by entry. The determinant is a polynomial in the entries (Bareiss' fraction-free elimination, or Laplace), and the adjugate's entries are cofactors. Only the division by the determinant is left, and its condition is the inverse's own.A matrix of numbers has the inverse it had: the existing inverse tests pass unchanged, and matrixcheck's
A A^-1 = IandA adj(A) = det(A) Iare clean on 1200 random matrices (seeds 14–16). The cost is the same, since GenericTensor's inversion also went through the adjugate.GenTensorGuard.InvertMatrixhad no caller left and is removed.Tests:
AnInverseIsTheAdjugateOverTheDeterminantTest, 7 cases. 4 fail on master; the numeric, singular and adjugate-value cases pass on both. The full suite, AOT and the nine harnesses pass. There is a BREAKING-CHANGES entry, measured on 2.6.0.🤖 Generated with Claude Code