Repository navigation
Keep single-row and single-column matrices as matrices in Transpose - #2007
Open
tombouctou wants to merge 7 commits into
Open
tombouctou wants to merge 7 commits into
tombouctou wants to merge 7 commits into
Conversation
Transpose[{{1, 2, 3}}] gave {1, 2, 3} instead of {{1}, {2}, {3}}:
the 2D case went through a SymPy matrix, and from_sympy_matrix turns
any one-column result into a vector. Transpose a 2D list by moving its
elements directly instead, which also leaves them untouched.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
LGTM |
rocky
reviewed
Oct 16, 2026
rocky
reviewed
Oct 16, 2026
rocky
reviewed
Oct 16, 2026
rocky
reviewed
Oct 16, 2026
Co-authored-by: R. Bernstein <rocky@users.noreply.github.com>
Add assert failure messages to new tests. Co-authored-by: R. Bernstein <rocky@users.noreply.github.com>
rocky
reviewed
Oct 16, 2026
Co-authored-by: R. Bernstein <rocky@users.noreply.github.com>
rocky
reviewed
Oct 16, 2026
Member
|
@tombouctou I am having problems editing the commit using the GitHub web interface. Would you run "black" on the revised code, please? A couple of things. First, please let's add assert fail messages on asserts rather than keeping these I've added an invitation to join this repository so you can make branches here rather than under the forked tombuctou repository. Making branches here will make it easier to suggest changes. What we often do is create a branch of the PR and then submit a PR to the PR. That way, you can remove and modify any suggested changes while I can use tools that are more black, isort, and mypy-friendly. Thanks. |
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.
Transposeturned a matrix with a single row into a vector:The 2D case went through a SymPy matrix, and
from_sympy_matrixreturns any result with one column as a flat vector. This changes the 2D case ofeval_Transposeto rearrange the elements directly, which also leaves them as they are instead of converting them to SymPy and back. The 3D case is unchanged.The same flattening affects other functions that return a SymPy matrix, e.g.
Inverse[{{2}}]gives{1/2}andRowReduce[{{1}, {2}}]gives{1, 0}; that is reported separately in #2006.Tests: new cases in
test/builtin/test_tensor.py. pytest and the doctests give the same results as on master, apart from environmental failures that also fail on master.🤖 Generated with Claude Code