Commit 44bb284b authored by Martin Reinecke's avatar Martin Reinecke
Browse files

remove ift.abs(Field); the builtin 'abs' does the trick just fine

parent a1648e6d
Pipeline #28206 passed with stages
in 3 minutes and 20 seconds
......@@ -190,7 +190,7 @@ class data_object(object):
return data_object(self._shape, -self._data, self._distaxis)
def __abs__(self):
return data_object(self._shape, np.abs(self._data), self._distaxis)
return data_object(self._shape, abs(self._data), self._distaxis)
def all(self):
return self.sum() == self.size
......@@ -258,7 +258,7 @@ def _math_helper(x, function, out):
_current_module = sys.modules[__name__]
for f in ["sqrt", "exp", "log", "tanh", "conjugate", "abs"]:
for f in ["sqrt", "exp", "log", "tanh", "conjugate"]:
def func(f):
def func2(x, out=None):
return _math_helper(x, f, out)
......@@ -20,7 +20,7 @@
import numpy as np
from numpy import ndarray as data_object
from numpy import full, empty, empty_like, sqrt, ones, zeros, vdot, abs, \
from numpy import full, empty, empty_like, sqrt, ones, zeros, vdot, \
exp, log, tanh
from .random import Random
......@@ -182,10 +182,9 @@ class RGSpace(StructuredDomain):
"not be the same.")
# Check if the distances match, i.e. dist' = 1 / (num * dist)
if not np.all(
np.absolute(np.array(self.shape) *
np.array(self.distances) *
np.array(codomain.distances)-1) < 1e-7):
if not np.all(abs(np.array(self.shape) *
np.array(self.distances) *
np.array(codomain.distances)-1) < 1e-7):
raise AttributeError("The grid-distances of domain and codomain "
"do not match.")
......@@ -519,7 +519,7 @@ class Field(object):
The L2-norm of the field values.
return np.sqrt(np.abs(self.vdot(x=self)))
return np.sqrt(abs(self.vdot(x=self)))
def conjugate(self):
""" Returns the complex conjugate of the field.
......@@ -540,7 +540,7 @@ class Field(object):
return Field(self._domain, -self.val)
def __abs__(self):
return Field(self._domain, dobj.abs(self.val))
return Field(self._domain, abs(self.val))
def _contraction_helper(self, op, spaces):
if spaces is None:
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