diff --git a/lib/gpt/ad/forward/series.py b/lib/gpt/ad/forward/series.py index 9d98ec26e..849a8262f 100644 --- a/lib/gpt/ad/forward/series.py +++ b/lib/gpt/ad/forward/series.py @@ -33,6 +33,8 @@ def promote(other, landau_O): class series(base): foundation = foundation + __array_ufunc__ = None + __numpy_ufunc__ = None def __init__(self, terms, landau_O): self.landau_O = landau_O diff --git a/tests/ad/ad.py b/tests/ad/ad.py index 591266ae5..3c54e43b1 100755 --- a/tests/ad/ad.py +++ b/tests/ad/ad.py @@ -392,3 +392,13 @@ def plaquette(U): err2 += abs((ref_b_grad - num_b_grad)[1]) ** 2 + abs((ref_b_grad - num_b_grad)[dbeta]) ** 2 g.message(f"Simple combined forward/reverse test: {err2}") assert err2 < 1e-12 + +##################################### +# Test numpy array compatibility +##################################### + +On = fad.landau(alpha**2) +series = fad.series(3, On) +arr = np.arange(1, 10, 1) + +assert isinstance(((series + arr) - (arr + series)), fad.series)