Printing matrix without toString()#2180
Closed
ReneEnjilian wants to merge 5 commits intoapache:mainfrom
Closed
Conversation
Contributor
Author
|
All checks fail. The error message for all of the 44 failing checks is something like: |
Contributor
|
Yes, that seems to be an external issue, but the missing license header (failed license check) is real, and once you made this change we get another run of the tests. |
Contributor
|
LGTM - Thanks for the patch @ReneEnjilian. During the merge, I moved the rewrite to static rewrites (in program rewriter), fixed the failing test, and removed commented code. |
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.
This patch enables the DML to print matrices and other datatypes (frame, list) without using the toString() method.
Previously, printing a matrix A required:
print(toString(A)).Now, printing can be done via:
print(A).The same applies to frames and lists. However, there are some remaining issues when datastructures are used with indexing. For example, while
A[1,]is also a matrix (first row of A),print(A[1,])will not print the correct output (first row) but rather only the first element of the first row. Internally, the compiler misinterprets the matrix as a scalar and does not propagate the correct size information. The propagated size information on the rewrite-level are (-1 x -1), meaning unknown. A work-around would be either to still use thetoStringmethod or, as shown in the test cases, to materialize the slicing before printing:B=A[1,],print(B).Similar problems exist with lists and frames but can be addressed by materializing the slicing/indexing outside the print as shown in the previous example. A future task should address this issue.
I promoted the rewrite from RewriteAlgebraicSimplificationStatic to having a separate class in the rewrite directory as discussed. Testing has been added.