Closed cbm755 closed 1 year ago
I traced this to linear indexing in SymPy. With Matrix M
one can do M[0]
and get the 1st element (i.e., same as M[0,0]
). But Array does not behave this way:
ipython:
In [30]: A = ImmutableDenseNDimArray((true, true, false, true, false, false), (2,3))
In [31]: B = Matrix(2, 3, range(10, 16))
In [32]: pprint(A)
⎡True True False⎤
⎢ ⎥
⎣True False False⎦
In [27]: pprint(B)
⎡10 11 12⎤
⎢ ⎥
⎣13 14 15⎦
In [28]: A[0]
Out[28]: [True, True, False]
In [29]: B[0]
Out[29]: 10
So we can either redo our uniop_...
and binop_
helpers yet again or check which behaviour is intended upstream.
Filed upstream https://github.com/sympy/sympy/issues/24007
I suspect we should re-write this code not to use linear indexing
Yeah, upstream is pretty clear that 2-d indexing is the way to go. 1-d indexing of Matrix is just b/c its always been that way. 1-d indexing of Array is not going to happen: Array is supposed to stay close to numpy behaviour.
So far so good! But try boolean op: