Repository navigation
Make the trace of a matrix that is not square null - #2572
Merged
Merged
Conversation
Matrix.Trace summed the main diagonal of any matrix, so [[1, 2, 3], [4, 5, 6]] had the trace 1 + 5 and [1, 2, 3] the trace 1, while trace(...) refused both: the trace is defined for a square matrix, as the sum of its eigenvalues. It is Entity? now, null for any other matrix, as Determinant, Inverse and Adjugate are. The parser and the evaluation of trace(...) match on the value instead of checking the shape first, and the catalogue query is typed to match. 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 @@
## master #2572 +/- ##
=======================================
Coverage 86.73% 86.73%
=======================================
Files 344 344
Lines 74833 74833
Branches 21837 21838 +1
=======================================
Hits 64905 64905
+ Misses 5361 5360 -1
- Partials 4567 4568 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
Fixes #2565.
Matrix.Tracesummed the main diagonal of any matrix, so[[1, 2, 3], [4, 5, 6]]had the trace1 + 5, and the vector[1, 2, 3]the trace1.trace(...)refused both. The trace is defined for a square matrix only, as the sum of its eigenvalues.The property is now
Entity?,nullfor a matrix that is not square, asDeterminant,InverseandAdjugateare. The parser and the evaluation oftrace(...)now match on the value instead of checking the shape first. The internal catalogue query is typed to match, and the MCP tool already handled anull.((Matrix)"[[1, 2, 3], [4, 5, 6]]").Trace1 + 5null((Matrix)"[1, 2, 3]").Trace1null((Matrix)"[[1, 2], [3, 4]]").Trace1 + 4"trace([[1, 2], [3, 4]])"1 + 4Local checks:
AngouriMathPublishAot=true;🤖 Generated with Claude Code