-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ivy: support non-scalar elements of vectors and matrices
In #117, @smasher164 observed that ,\1 2 3 generates 1 (1 2) (1 2 3) despite the claim that ivy does not support non-scalar elements. I looked into preventing them from ever appearing, but that was messy and slow as it requires a lot of post-construction checking of things. So I tried the other direction, and made them legal. That turned out to be much more straightforward than I thought, although there were a number of associated changes to make it work. Whenever the existing barriers were removed, the code must actually work. Significant changes and bug fixes: - Fixed a trivial bug in parse that did not allow indexed expressions in vectors, for example 1 2 x[3] 4 - Can now input compound elements of vectors: 1 (1 2) 3 - They must also be printable clearly, and for simplicity I made the output model the input, at least for these simple vector cases. - Indexed assignment needed some tweaks, including fixing an existing bug: The rhs was not copied, so aliasing could happen and it was easy to demostrate bad behavior. Added a Copy method to Value to clean this up. - Support matrices and vectors in OrderedCompare. - Update and extend the tests. Some failure tests now worked! I didn't touch the docs. Not clear a change is needed, although this might be worth a phrase somewhere, perhaps in the demo. Also simplify the method for printing matrices, which will make it easier to fix a layout issue: A multiline matrix as an element of an array or matrix results in ugly output. Relatively easy to fix, but to be a separate change. Update #117
- Loading branch information
Showing
23 changed files
with
352 additions
and
137 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,10 @@ | |
1 5/2 1 | ||
5/2 1 5/2 | ||
|
||
2 3 rho 1 (2 3) | ||
1 (2 3) 1 | ||
(2 3) 1 (2 3) | ||
|
||
# Higher dimensions | ||
|
||
2 3 4 rho iota 24 | ||
|
Oops, something went wrong.