From 3396dd2b523e2cd3f1d83d880e59942a95ee540b Mon Sep 17 00:00:00 2001 From: Christoph Lehner Date: Mon, 6 Nov 2023 08:21:09 +0100 Subject: [PATCH] adjust test precision to appropriate value --- tests/ad/ad.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/ad/ad.py b/tests/ad/ad.py index f20ec29f..9520d9c3 100755 --- a/tests/ad/ad.py +++ b/tests/ad/ad.py @@ -185,15 +185,17 @@ def scale(lam): est = (scale(eps) - scale(-eps)) / 2 / eps exa = fad.inner_product(ly, lx * ly)[dm] -err2 = abs(est - exa) / abs(exa) -assert err2 < 1e-7 +err = abs(est - exa) / abs(exa) g.message(f"d <.,.> / dm : {err2}") +assert err < 1e-7 + est = (scale(eps) + scale(-eps) - 2 * scale(0)) / eps**2 / 2 exa = fad.inner_product(ly, lx * ly)[dm**2] -err2 = abs(est - exa) / abs(exa) -assert err2 < 1e-7 +err = abs(est - exa) / abs(exa) g.message(f"d <.,.> / dm**2 : {err2}") +assert err < 1e-5 + test = fad.norm2(fad.cshift(fad.cshift(lz, 0, 1), 0, -1) - lz) g.message(test)