Repository navigation
Conversation
…ressions The tail of a truncated expression sliced the variable labels along the first axis, which for a quadratic expression is the factor axis, so the terms after the ellipsis repeated the first variables next to the last coefficients. The constant was also printed before the ellipsis as well as at the end.
Merging this PR will not alter performance
Comparing Footnotes
|
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.
Changes proposed in this Pull Request
This PR fixes the string representation of long expressions so that the constant is printed only once and variables in quadratic tails are correctly aligned.
Note
The following content was generated by AI.
When an expression has more terms than
display_max_terms, the truncated representation printed the constant twice, once before the ellipsis and once at the end (e.g.,+1 x[0] + 2 x[1] + 3 x[2] + 5 ... +8 x[7] + 9 x[8] + 10 x[9] + 5). Additionally, for quadratic expressions, the variables in the tail were incorrectly matched because the array was sliced along the wrong dimension. I fixed this by slicing the variables along the term axis (v[..., -truncate:]) and explicitly omitting the constant from the first half of the string. I added two exact string-matching tests for the representations. The release notes entry is included and the PR number will be added in a follow-up commit. The code changes and tests were originally drafted with the help of Claude.Checklist
AGENTS.md).doc.doc/release_notes.rstof the upcoming release is included.