[h5py] 327/455: Speed up the common case of non-broadcast selection
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag 1.3.0
in repository h5py.
commit 96b7bc0f363b9f10dd9d16123c6c41f28f140f85
Author: andrewcollette <andrew.collette at gmail.com>
Date: Wed Nov 25 03:27:06 2009 +0000
Speed up the common case of non-broadcast selection
---
h5py/selections.py | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/h5py/selections.py b/h5py/selections.py
index fb5f9c0..cd70b3c 100644
--- a/h5py/selections.py
+++ b/h5py/selections.py
@@ -230,13 +230,15 @@ class SimpleSelection(Selection):
chunks = tuple(x/y for x, y in zip(count, tshape))
nchunks = np.product(chunks)
- sid = self._id.copy()
- sid.select_hyperslab((0,)*rank, tshape, step)
-
- for idx in xrange(nchunks):
- offset = tuple(x*y*z + s for x, y, z, s in zip(np.unravel_index(idx, chunks), tshape, step, start))
- sid.offset_simple(offset)
- yield sid
+ if nchunks == 1:
+ yield self._id
+ else:
+ sid = self._id.copy()
+ sid.select_hyperslab((0,)*rank, tshape, step)
+ for idx in xrange(nchunks):
+ offset = tuple(x*y*z + s for x, y, z, s in zip(np.unravel_index(idx, chunks), tshape, step, start))
+ sid.offset_simple(offset)
+ yield sid
class HyperSelection(_Selection_1D):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/h5py.git
More information about the debian-science-commits
mailing list