Commit 8e75c29a authored by Martin Reinecke's avatar Martin Reinecke
Browse files

fix

parent b2a5dd5c
...@@ -559,7 +559,7 @@ def absmax(arr): ...@@ -559,7 +559,7 @@ def absmax(arr):
if arr._data.size == 0: if arr._data.size == 0:
tmp = np.array(0, dtype=arr._data.dtype) tmp = np.array(0, dtype=arr._data.dtype)
else: else:
tmp = np.linalg.norm(arr._data, ord=np.inf) tmp = np.asarray(np.linalg.norm(arr._data, ord=np.inf))
res = np.empty_like(tmp) res = np.empty_like(tmp)
_comm.Allreduce(tmp, res, MPI.MAX) _comm.Allreduce(tmp, res, MPI.MAX)
return res[()] return res[()]
...@@ -568,7 +568,7 @@ def absmax(arr): ...@@ -568,7 +568,7 @@ def absmax(arr):
def norm(arr, ord=2): def norm(arr, ord=2):
if ord == np.inf: if ord == np.inf:
return absmax(arr) return absmax(arr)
tmp = np.linalg.norm(np.atleast_1d(arr._data), ord=ord) ** ord tmp = np.asarray(np.linalg.norm(np.atleast_1d(arr._data), ord=ord) ** ord)
res = np.empty_like(tmp) res = np.empty_like(tmp)
_comm.Allreduce(tmp, res, MPI.SUM) _comm.Allreduce(tmp, res, MPI.SUM)
return res[()] ** (1./ord) return res[()] ** (1./ord)
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