-
-
Notifications
You must be signed in to change notification settings - Fork 132
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior
Description
Describe the bug
1D DOK arrays lets the user "access" elements at higher dimensions
To Reproduce
>>> import numpy as np; import sparse
>>> shape=(5,)
>>> density=0.2
>>> s = sparse.random(shape, density, format="dok")
>>> s
<DOK: shape=(5,), dtype=float64, nnz=1, fill_value=0.0>
>>> s[1]
0.0
>>> s[2]
0.0
>>> s[1,1]
<DOK: shape=(2,), dtype=float64, nnz=0, fill_value=0.0>
>>> s[1,1,1]
<DOK: shape=(3,), dtype=float64, nnz=0, fill_value=0.0>
>>> s[1,1,1,1]
<DOK: shape=(4,), dtype=float64, nnz=0, fill_value=0.0>
>>> s[1,1,1,1,1]
<DOK: shape=(5,), dtype=float64, nnz=0, fill_value=0.0>
>>> s[1,1,1,1,1,1]
<DOK: shape=(6,), dtype=float64, nnz=0, fill_value=0.0>
>>> s[3,4,5]
<DOK: shape=(3,), dtype=float64, nnz=1, fill_value=0.0>
# and so on
Expected behavior
Should give IndexingError
System
- OS and version: Ubuntu 20.04
sparseversion:master- NumPy version: 1.19.2
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior