Skip to content

Commit

Permalink
added test for ad.forward.series objects with numpy arrays, fixes leh…
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Knuettel authored and Daniel Knuettel committed Feb 29, 2024
1 parent 618bc8f commit c4d20c5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/ad/ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit c4d20c5

Please sign in to comment.