Closed fzipp closed 1 year ago
There is another issue with the zero fill:
x = 3 3 rho iota 9; x
1 2 3
4 5 6
7 8 9
y = 1 take x x; y
(1 2 3|
|4 5 6|
|7 8 9)
2 take y
(1 2 3| 0
|4 5 6|
|7 8 9)
The second element is a scalar, while the first element is a matrix. Comare with APL:
x←3 3 ⍴ ⍳9
1 2 3
4 5 6
7 8 9
y←⊂x
┌─────┐
│1 2 3│
│4 5 6│
│7 8 9│
└─────┘
2↑y
┌─────┬─────┐
│1 2 3│0 0 0│
│4 5 6│0 0 0│
│7 8 9│0 0 0│
└─────┴─────┘
Here, both elements are matrices.
Commit https://github.com/robpike/ivy/commit/05a8373fa28de7b4812be8e1d210f6dc3eec65d6 added support for large takes (with zero fill) and large drops (returning an empty vector) for vectors, but it doesn't work with matrices:
Expected behavior (consistent with APL):