Dear Maintainer,
I could reproduce this failure in a bullseye VM.
There the "test_nufft_adjoint" fails in about 1.2 % of the runs.

Attached diff helps to make it more visible.

It looks like the float comparison fails because the
limit of "1.E-6f" is slightly not enough.

If interpret following floating point comparison document right,
then the failing cases are just 8 representable floats "ULPs"
away from the expected value, below 8 it does not fail.

  
https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/

Maybe upstream could consider changing that
float comparison to something like this:

  
https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/ddraw/tests/ddraw7.c#l61


In the newer Bookworm package I have found following patch,
which does relax exactly this test:

  
https://salsa.debian.org/med-team/bart/-/blob/master/debian/patches/0003-relax-failing-unit-test.patch

But for some reason it does still not fail if I remove that
patch in the Bookworm version.

Kind regards,
Bernhard



make utest
while true; do ./test_nufft ; done


Bullseye/stable/bart-0.6.00:
- -1.067273+3.247031i - -1.067273+3.247030i - sc1=6.3619987432198080e+01 
sc2=6.3619926397041880e+01 diff=9.6109602054639254e-07 diff_ulp=7
adjoint diff: 0.000001 9.6109602054639254e-07, limit: 9.9999999747524271e-07
        ./test_nufft:  1/ 1 passed.

- -1.067273+3.247030i - -1.067273+3.247030i - sc1=6.3619926397041830e+01 
sc2=6.3619926397041880e+01 diff=8.3446502685546875e-07 diff_ulp=7
adjoint diff: 0.000001 8.3446502685546875e-07, limit: 9.9999999747524271e-07
        ./test_nufft:  1/ 1 passed.

- -1.067273+3.247031i - -1.067273+3.247030i - sc1=6.3619987432198087e+01 
sc2=6.3619926397041880e+01 diff=8.5963040419301251e-07 diff_ulp=6
adjoint diff: 0.000001 8.5963040419301251e-07, limit: 9.9999999747524271e-07
        ./test_nufft:  1/ 1 passed.

- -1.067272+3.247031i - -1.067273+3.247030i - sc1=6.3619987432198073e+01 
sc2=6.3619926397041880e+01 diff=1.0662403155947686e-06 diff_ulp=8
adjoint diff: 0.000001 1.0662403155947686e-06, limit: 9.9999999747524271e-07
ERROR:         ./test_nufft:  0/ 1 passed.

- -1.067273+3.247031i - -1.067273+3.247030i - sc1=6.3619987432198087e+01 
sc2=6.3619926397041880e+01 diff=8.5963040419301251e-07 diff_ulp=6
adjoint diff: 0.000001 8.5963040419301251e-07, limit: 9.9999999747524271e-07
        ./test_nufft:  1/ 1 passed.

- -1.067273+3.247031i - -1.067273+3.247030i - sc1=6.3619987432198080e+01 
sc2=6.3619926397041880e+01 diff=9.6109602054639254e-07 diff_ulp=7
adjoint diff: 0.000001 9.6109602054639254e-07, limit: 9.9999999747524271e-07
        ./test_nufft:  1/ 1 passed.


Bookworm/testing/bart-0.8.00:
- -1.067272+3.247031i - -1.067273+3.247030i - sc1=6.3619987432198073e+01 
sc2=6.3619926397041880e+01 diff=1.0662403155947686e-06 diff_ulp=8
adjoint diff: 0.000000 3.1195452265819767e-07, limit: 9.9999999747524271e-07
        ./test_nufft:  1/ 1 passed.
diff --git a/src/linops/lintest.c b/src/linops/lintest.c
index c1d1ebc..b0e3bc1 100644
--- a/src/linops/lintest.c
+++ b/src/linops/lintest.c
@@ -59,7 +59,7 @@ static float linop_test_adjoint_generic(const struct linop_s* op, bool rvc)
 	md_free(tmp3);
 	md_free(tmp4);
 
-	debug_printf(DP_DEBUG4, "- %f%+fi - %f%+fi -\n", crealf(sc1), cimagf(sc1), crealf(sc2), cimagf(sc2));
+	debug_printf(DP_INFO, "- %f%+fi - %f%+fi - sc1=%.16e sc2=%.16e diff=%.16e diff_ulp=%d\n", crealf(sc1), cimagf(sc1), crealf(sc2), cimagf(sc2), sc1, sc2, cabsf(sc1 - sc2), abs(*(int*)&sc1 - *(int*)&sc2));
 
 	return cabsf(sc1 - sc2);
 }
diff --git a/utests/test_nufft.c b/utests/test_nufft.c
index ec02762..54163dc 100644
--- a/utests/test_nufft.c
+++ b/utests/test_nufft.c
@@ -112,7 +112,7 @@ static bool test_nufft_adjoint(void)
 
 	float diff = linop_test_adjoint(op);
 
-	debug_printf(DP_DEBUG1, "adjoint diff: %f\n", diff);
+	debug_printf(DP_INFO, "adjoint diff: %f %.16e, limit: %.16e\n", diff, diff, 1.E-6f);
 
 	bool ret = (diff < 1.E-6f);
 
@@ -231,13 +231,6 @@ static bool test_nufft_basis_toeplitz(void)
 
 
 
-UT_REGISTER_TEST(test_nufft_forward);
 UT_REGISTER_TEST(test_nufft_adjoint);
-UT_REGISTER_TEST(test_nufft_normal);
-UT_REGISTER_TEST(test_nufft_toeplitz_weights);
-UT_REGISTER_TEST(test_nufft_toeplitz_noweights);
-UT_REGISTER_TEST(test_nufft_basis_adjoint);
-UT_REGISTER_TEST(test_nufft_basis_normal);
-UT_REGISTER_TEST(test_nufft_basis_toeplitz);
 
 

Reply via email to