Commit 6741a646 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

cosmetics

parent 2f5dab3d
...@@ -31,16 +31,15 @@ from ..utilities import iscomplextype ...@@ -31,16 +31,15 @@ from ..utilities import iscomplextype
def _multiToArray(fld): def _multiToArray(fld):
szall = 0 szall = sum(2*v.size if iscomplextype(v.dtype) else v.size
for val in fld.values(): for v in fld.values())
szall += 2*val.size if iscomplextype(val.dtype) else val.size
res = np.empty(szall, dtype=np.float64) res = np.empty(szall, dtype=np.float64)
ofs = 0 ofs = 0
for val in fld.values(): for val in fld.values():
sz2 = 2*val.size if iscomplextype(val.dtype) else val.size sz2 = 2*val.size if iscomplextype(val.dtype) else val.size
locdat = val.local_data.reshape(-1) locdat = val.local_data.reshape(-1)
if iscomplextype(val.dtype): if iscomplextype(val.dtype):
locdat = locdat.astype(np.complex128).view(np.float64) locdat = locdat.view(locdat.real.dtype)
res[ofs:ofs+sz2] = locdat res[ofs:ofs+sz2] = locdat
ofs += sz2 ofs += sz2
return res return res
......
Supports Markdown
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