Skip to content

Commit 4281e28

Browse files
committed
Minor fix of __getitem__
1 parent bba9fcc commit 4281e28

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

examples/darray.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@
7070
s1 = MPI.COMM_WORLD.reduce(np.linalg.norm(z2)**2)
7171
if MPI.COMM_WORLD.Get_rank() == 0:
7272
assert abs(s0-s1) < 1e-12
73-
73+
print('hei')
7474
N = (3, 3, 6, 6, 6)
7575
z2 = DistArray(N, dtype=float, val=1, alignment=2, rank=2)
7676
z2[:] = MPI.COMM_WORLD.Get_rank()
77-
z1 = z2.redistribute(1)
78-
z0 = z1.redistribute(0)
77+
#z1 = z2.redistribute(1)
78+
#z0 = z1.redistribute(0)
7979

8080
s0 = MPI.COMM_WORLD.reduce(np.linalg.norm(z2)**2)
8181
s1 = MPI.COMM_WORLD.reduce(np.linalg.norm(z0)**2)

mpi4py_fft/distarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def __getitem__(self, i):
140140
v0 = np.ndarray.__getitem__(self, i)
141141
v0._rank -= 1
142142
return v0
143-
if isinstance(i, tuple) and self.rank == 2:
143+
if isinstance(i, tuple) and len(i) == 2 and self.rank == 2:
144144
v0 = np.ndarray.__getitem__(self, i)
145145
v0._rank = 0
146146
return v0

0 commit comments

Comments
 (0)