Repository navigation
The row echelon forms divide exactly - #2279
Merged
Rafael-SOWNet merged 3 commits intoOct 31, 2026
Merged
Conversation
The reduced row echelon form of an invertible 4x4 of small rationals had NaN entries, and its Rank threw InvalidCastException. Both forms were GenericTensor's SafeDivision elimination, which keeps every entry as a numerator and a denominator that are never reduced against each other. That is for element types whose division truncates, and an Entity divides exactly. Unreduced, the pairs grew with every row operation and the back substitution squared them: the issue's matrix ended with a denominator near 1e-246, and 0 over it is NaN (#2277). A 7x7 took nine seconds and an 8x8 did not return. Both forms now use the Simple elimination, which divides as it goes. MatrixTest takes the issue's matrix and two more of a random sweep to the identity with rank 4, and an 8x8 with determinant -5598, bounded at a minute. All four fail on master, the 8x8 by not returning. The suite, the trio, F#, AOT and the eight harnesses pass. Symbolic forms are written otherwise, [[a, b], [c, d]]'s row echelon form among them. Traced, with GenericTensor's elimination written out step by step, by a subagent. Fixes #2270. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
One 7x7 of small entries took 112 seconds through the SafeDivision elimination, with 42 NaN entries. Nine seconds was another matrix's. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2279 +/- ##
==========================================
+ Coverage 86.70% 86.71% +0.01%
==========================================
Files 310 310
Lines 67869 67869
Branches 19701 19701
==========================================
+ Hits 58843 58854 +11
+ Misses 4903 4892 -11
Partials 4123 4123
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
#2272 wraps both forms' simplified matrix in OfTheShapeOf, and this branch moves both to the Simple elimination; each form now does both. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Rafael-SOWNet
deleted the
the-reduced-row-echelon-form-divides-exactly
branch
October 31, 2026 02:03
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.
The reduced row echelon form of an invertible 4x4 of small rationals had NaN entries, and its
RankthrewInvalidCastException. Both forms used GenericTensor's SafeDivision elimination. It keeps every entry as a numerator and a denominator that are never reduced against each other, which suits element types whose division truncates; an Entity divides exactly. Unreduced, the pairs grow with every row operation, and the back substitution squares them. The issue's matrix ended with a denominator near 1e-246, and 0 divided by that is NaN, which is #2277. One 7x7 of small entries took 112 seconds, with 42 NaN entries, and an 8x8 did not return.Both forms now use the Simple elimination, which divides as it goes.
.RankInvalidCastException4.ReducedRowEchelonFormInvalidCastException[[a, b], [c, d]],.RowEchelonForm[[a, b], [(c * a + -c * a) / a, (d * a + -c * b) / a]][[a, b], [c + -c / a * a, d + -c / a * b]]MatrixTestreduces the issue's matrix, and two more from a random sweep, to the identity with rank 4. It also reduces an 8x8 with determinant -5598, bounded at a minute. All four cases fail on master, the 8x8 by not returning. The suite (18,233), the trio, F#, AOT and the eight harnesses pass locally.The subagent that traced this ran a sweep against an exact Gauss–Jordan reference. Master gave NaN on 13 of 600 4x4s and on 38 of 200 5x5s; this branch gave none. Symbolic forms change shape but not value: on 13 symbolic matrices it judged, the verdicts were the same on both routes, and 10 of them are wrong on both, because
InnerSimplifieddoes not collapsex + -xbefore taking it as a pivot. That is a separate problem.This edits the same two lines as #2272, so whichever merges second will need one conflict resolved.
Fixes #2270.
🤖 Generated with Claude Code