Repository navigation
BUG: do not raise IndexError for identity slice in array.vindex - #3559
Merged
Merged
Conversation
mrocklin
reviewed
Jun 7, 2018
| identity_slices = ((0, num_in_dim, 1) # i.e, x[:] | ||
| for num_in_dim in self.shape) | ||
| if all(slice_ == identity for slice_, identity in zip(slices, identity_slices)): | ||
| return self |
Member
There was a problem hiding this comment.
Perhaps inline identity_slices here?
if all(slc == slice(0, d) for slc, d in zip(slices, self.shape)):
...
This might reduce cognitive load from future readers a bit, rather than have to cross check against the variable definition above.
Member
Author
There was a problem hiding this comment.
Nice. That helps makes the code simpler.
mrocklin
reviewed
Jun 7, 2018
| a, b = 10, 20 | ||
|
|
||
| x = rng.random(a, chunks=a // 2) | ||
| assert x is x.vindex[:] |
Member
There was a problem hiding this comment.
Can we also test x.vindex[:10] here for completeness?
Member
|
A couple tiny style comments, but otherwise this looks good to me. Thanks @stsievert ! |
Member
|
ping |
Member
Author
|
Updated. Thanks for the review. |
Member
|
Fixes #3211 |
Member
|
This is in. Thanks @stsievert ! |
convexset
added a commit
to convexset/dask
that referenced
this pull request
Jun 12, 2018
* master: [array.linalg.qr] added sfqr (short-and-fat) as a counterpart to tsqr… (dask#3575) Drop Dask Array's `learn` module (dask#3580) Adds `isneginf` and `isposinf` (dask#3581) Update sizeof definitions (dask#3582) BUG: do not raise IndexError for identity slice in array.vindex (dask#3559) Correct internal dimension of Dask's SVD (dask#3517) Fix check in configuration with env=None (dask#3562) Dataframe sample method docstring fix (dask#3566) Include "region" in key names for da.store (dask#3540) # Conflicts: # dask/array/linalg.py # dask/array/tests/test_linalg.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This closes #3211. This PR ensures that
x is x.vindex[:]for a Dask arrayx. This works for any identity indexing slice, not only 1D (e.g.,x[:, :]orx[:, :, :]).test_vindex_identity.x[:n - 1]orx[1:]) and slices with a stride of 2 (x[0:n:2]).flake8 dask(well, warns on a bunch but not on this diff).