Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative indexing for Array is inconsistent #14678

Open
dcabecinhas opened this issue Apr 30, 2018 · 0 comments
Open

Negative indexing for Array is inconsistent #14678

dcabecinhas opened this issue Apr 30, 2018 · 0 comments
Labels

Comments

@dcabecinhas
Copy link

dcabecinhas commented Apr 30, 2018

The negative indexing for sympy.Array seems to be broken.

In [1]: import numpy as np
   ...: import sympy as sp
   ...: 
   ...: a = np.array([[1,2],[3,4]])
   ...: b = sp.Array(a)
   ...: c = sp.Matrix(a)

In [2]: a[:,-1]
Out[2]: array([2, 4])

In [3]: b[:,-1]
Out[3]: [4  2]

In [4]: c[:,-1]
Out[4]: 
⎡2⎤
⎢ ⎥
⎣4⎦

The input b[:,-1] returns the reversed array [4 2] instead of the expected [2 4]. Using positive indexing for the last column returns the correct result

In [5]: b[:,1]
Out[5]: [2  4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants