Commit 5102e573 authored by Martin Reinecke's avatar Martin Reinecke

small tweaks

parent d0a8f4d8
......@@ -462,15 +462,16 @@ def redistribute(arr, dist=None, nodist=None):
rbuf = rbuf.reshape(local_shape(arr.shape, dist))
arrnew = from_local_data(arr.shape, rbuf, distaxis=dist)
else:
arrnew = empty(arr.shape, dtype=arr.dtype, distaxis=dist)
arrnew = np.empty(local_shape(arr.shape, dist), dtype=arr.dtype)
rslice = [slice(None)]*arr._data.ndim
ofs = 0
for i in range(ntask):
lo, hi = _shareRange(arr.shape[arr._distaxis], ntask, i)
rslice[arr._distaxis] = slice(lo, hi)
sz = rsz[i]//arr._data.itemsize
arrnew._data[rslice].flat = rbuf[ofs:ofs+sz]
arrnew[rslice].flat = rbuf[ofs:ofs+sz]
ofs += sz
arrnew = from_local_data(arr.shape, arrnew, distaxis=dist)
return arrnew
......@@ -499,15 +500,15 @@ def transpose(arr):
r_msg = [rbuf, (rsz, rdisp), MPI.BYTE]
_comm.Alltoallv(s_msg, r_msg)
del sbuf # free memory
arrnew = empty((arr.shape[1], arr.shape[0]), dtype=arr.dtype, distaxis=0)
ofs = 0
sz2 = _shareSize(arr.shape[1], ntask, rank)
arrnew = np.empty((sz2, arr.shape[0]), dtype=arr.dtype)
ofs = 0
for i in range(ntask):
lo, hi = _shareRange(arr.shape[0], ntask, i)
sz = rsz[i]//arr._data.itemsize
arrnew._data[:, lo:hi] = rbuf[ofs:ofs+sz].reshape(hi-lo, sz2).T
arrnew[:, lo:hi] = rbuf[ofs:ofs+sz].reshape(hi-lo, sz2).T
ofs += sz
return arrnew
return from_local_data((arr.shape[1],arr.shape[0]), arrnew, 0)
def default_distaxis():
......
......@@ -381,7 +381,9 @@ class Field(object):
Field
The complex conjugated field.
"""
return Field(self._domain, self._val.conjugate())
if np.issubdtype(self._val.dtype, np.complexfloating):
return Field(self._domain, self._val.conjugate())
return self
# ---General unary/contraction methods---
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment