mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 14:50:25 +01:00
rtruediv for Corr and Obs implemented
This commit is contained in:
parent
904396dbdd
commit
b23fe67994
2 changed files with 7 additions and 4 deletions
|
@ -752,11 +752,14 @@ class Corr:
|
|||
return self._apply_func_to_corr(np.arctanh)
|
||||
|
||||
# Right hand side operations (require tweak in main module to work)
|
||||
def __radd__(self, y):
|
||||
return self + y
|
||||
|
||||
def __rsub__(self, y):
|
||||
return -self + y
|
||||
|
||||
def __rmul__(self, y):
|
||||
return self * y
|
||||
|
||||
def __radd__(self, y):
|
||||
return self + y
|
||||
def __rtruediv__(self, y):
|
||||
return (self / y) ** (-1)
|
||||
|
|
|
@ -642,10 +642,8 @@ class Obs:
|
|||
else:
|
||||
if isinstance(y, np.ndarray):
|
||||
return np.array([self / o for o in y])
|
||||
|
||||
elif y.__class__.__name__ == 'Corr':
|
||||
return NotImplemented
|
||||
|
||||
else:
|
||||
return derived_observable(lambda x, **kwargs: x[0] / y, [self], man_grad=[1 / y])
|
||||
|
||||
|
@ -655,6 +653,8 @@ class Obs:
|
|||
else:
|
||||
if isinstance(y, np.ndarray):
|
||||
return np.array([o / self for o in y])
|
||||
elif y.__class__.__name__ == 'Corr':
|
||||
return NotImplemented
|
||||
else:
|
||||
return derived_observable(lambda x, **kwargs: y / x[0], [self], man_grad=[-y / self.value ** 2])
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue