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

DOK indexing bug #500

Closed
sayandip18 opened this issue Jul 6, 2021 · 0 comments · Fixed by #501
Closed

DOK indexing bug #500

sayandip18 opened this issue Jul 6, 2021 · 0 comments · Fixed by #501
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@sayandip18
Copy link
Contributor

Describe the bug
Indexing DOK with slices does not give the expected results

To Reproduce

>>> import sparse; shape=(3,3); density=0.11111111111111119; indices=(slice(1, None, -1), slice(None, None, 1))
>>> s = sparse.random(shape, density, format="dok")
>>> x = s.todense()
>>> x
array([[0.        , 0.        , 0.        ],
       [0.        , 0.        , 0.32402132],
       [0.        , 0.        , 0.        ]])
>>> s
<DOK: shape=(3, 3), dtype=float64, nnz=1, fill_value=0.0>
>>> s.todense()
array([[0.        , 0.        , 0.        ],
       [0.        , 0.        , 0.32402132],
       [0.        , 0.        , 0.        ]]) 
>>> s[indices]
<DOK: shape=(2, 3), dtype=float64, nnz=0, fill_value=0.0>
>>> s[indices].todense()
array([[0., 0., 0.],
       [0., 0., 0.]])
>>> x[indices]
array([[0.        , 0.        , 0.32402132],
       [0.        , 0.        , 0.        ]])

Expected behavior
s[indices][0,2] should be 0.32402132

System

  • OS and version: Ubuntu 20.04.1
  • sparse version: master
@sayandip18 sayandip18 added the bug Indicates an unexpected problem or unintended behavior label Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant