python-flint
python-flint copied to clipboard
Test failures on i686
With clean 0.8.0 sources from pypi See: https://github.com/void-linux/void-packages/actions/runs/17418979707/job/49453428886?pr=56979
To summarize, 1 test failure is:
test_fq_default_poly...Traceback (most recent call last):
File ".../flint/test/__main__.py", line 37, in run_tests
test()
~~~~^^
File ".../flint/test/test_all.py", line 5030, in test_fq_default_poly
assert raises(lambda: f.inverse_mod(2*f), ValueError)
~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
Error in test_fq_default_poly
The 8 doctest failures:
**********************************************************************
File ".../flint/types/acb.cpython-313-i386-linux-gnu.so", line 529, in flint.types.acb.acb.pow
Failed example:
acb.integral(lambda z, a: z.pow(acb("1/3"), analytic=a), -5-1j, -5+1j)
Expected:
[+/- 2.66e-14] + [1.8108516218463 +/- 3.58e-14]j
Got:
[+/- 2.71e-14] + [1.8108516218463 +/- 3.58e-14]j
**********************************************************************
File ".../flint/types/acb_mat.cpython-313-i386-linux-gnu.so", line 688, in flint.types.acb_mat.acb_mat.eig
Failed example:
for c in A.eig(algorithm="rump"): print(c)
Expected:
[1.10529963495745 +/- 4.71e-15] + [+/- 2.92e-15]j
[-1.91702762744092 +/- 8.45e-15] + [+/- 3.86e-15]j
[36.8117279924835 +/- 4.72e-14] + [+/- 9.07e-15]j
Got:
[1.10529963495745 +/- 4.71e-15] + [+/- 2.92e-15]j
[-1.91702762744092 +/- 8.46e-15] + [+/- 3.87e-15]j
[36.8117279924835 +/- 4.72e-14] + [+/- 9.11e-15]j
**********************************************************************
File ".../flint/types/acb_mat.cpython-313-i386-linux-gnu.so", line 731, in flint.types.acb_mat.acb_mat.eig
Failed example:
acb_mat.dft(4).eig(multiple=True)
Expected:
[[-1.0000000000000 +/- 2.26e-15] + [+/- 1.23e-15]j, [+/- 4.96e-16] + [-1.00000000000000 +/- 3.72e-16]j, [1.00000000000000 +/- 4.98e-16] + [+/- 3.42e-16]j, [1.00000000000000 +/- 4.98e-16] + [+/- 3.42e-16]j]
Got:
[[-1.0000000000000 +/- 1.78e-15] + [+/- 1.08e-15]j, [+/- 8.93e-16] + [-1.0000000000000 +/- 1.79e-15]j, [1.00000000000000 +/- 1.25e-16] + [+/- 2.02e-16]j, [1.00000000000000 +/- 1.25e-16] + [+/- 2.02e-16]j]
**********************************************************************
File ".../flint/types/acb_mat.cpython-313-i386-linux-gnu.so", line 745, in flint.types.acb_mat.acb_mat.eig
Failed example:
for c in acb_mat.dft(4).eig(algorithm="approx"): print(c.str(radius=False))
Expected:
-0.999999999999999 - 7.85046229341892e-17j
-2.35513868802566e-16 - 1.00000000000000j
1.00000000000000 - 6.64346650360854e-17j
0.999999999999999 - 5.14675360671472e-17j
Got:
-0.999999999999999 - 7.89299181569447e-17j
-0.999999999999999j
1.00000000000000 - 7.76288755499621e-17j
0.999999999999999 + 5.73542949244832e-17j
**********************************************************************
File ".../flint/types/fq_default_poly.cpython-313-i386-linux-gnu.so", line 1210, in flint.types.fq_default_poly.fq_default_poly.inv_sqrt_trunc
Failed example:
h
Expected:
(23030*z + 8965)*x^2 + (43656*z + 7173)*x + (27935*z + 28199)
Got:
(33368*z + 48774)*x^2 + (65371*z + 7741)*x + (42319*z + 52213)
**********************************************************************
File ".../flint/types/fq_default_poly.cpython-313-i386-linux-gnu.so", line 1557, in flint.types.fq_default_poly.fq_default_poly.roots
Failed example:
f.roots(multiplicities=False)
Expected:
[1, 2, 3]
Got:
[1, 3, 2]
**********************************************************************
File ".../flint/types/fq_default_poly.cpython-313-i386-linux-gnu.so", line 105, in flint.types.fq_default_poly.fq_default_poly_ctx.base_field
Failed example:
R.base_field()
Expected:
fq_default_ctx(65537, 3, 'z', x^3 + 3*x^2 + 30077, 'FQ_NMOD')
Got:
fq_default_ctx(65537, 3, 'z', x^3 + 5734*x^2 + 58786, 'FQ_NMOD')
**********************************************************************
File ".../flint/types/nmod_poly.cpython-313-i386-linux-gnu.so", line 771, in flint.types.nmod_poly.nmod_poly.factor
Failed example:
nmod_poly([3,2,1,2,3], 7).factor(algorithm='berlekamp')
Expected:
(3, [(x + 2, 1), (x + 4, 1), (x^2 + 4*x + 1, 1)])
Got:
(3, [(x^2 + 4*x + 1, 1), (x + 2, 1), (x + 4, 1)])
**********************************************************************
6 items had failures:
1 of 2 in flint.types.acb.acb.pow
3 of 23 in flint.types.acb_mat.acb_mat.eig
1 of 7 in flint.types.fq_default_poly.fq_default_poly.inv_sqrt_trunc
1 of 5 in flint.types.fq_default_poly.fq_default_poly.roots
1 of 2 in flint.types.fq_default_poly.fq_default_poly_ctx.base_field
1 of 5 in flint.types.nmod_poly.nmod_poly.factor
***Test Failed*** 8 failures and 12 skipped tests.
flint.test: 1 of 62 tests failed
flint.test: 8 of 3090 doctests failed
Test failure is fixed by:
--- a/src/flint/test/test_all.py
+++ b/src/flint/test/test_all.py
@@ -5019,7 +5019,7 @@
while True:
# Ensure f is invertible
f = R_test.random_element()
- if not f.constant_coefficient().is_zero():
+ if not f.is_constant() and not f.constant_coefficient().is_zero():
break
while True:
h = R_test.random_element()
(because f.inverse_mod(2*f) does not fail when f is a non-zero constant)
Some of these are the same as were fixed in gh-262.
There should at least be a CI job that tests a 32-bit build. GitHub Actions does not provide 32-bit runners though. If the WASM build was completed then maybe that would be enough.
I've just merged gh-318 which adds tests for wasm32 in CI and fixes up the tests.
Is it possible to test if that fixes the issue from the main branch here?
Here's the result with this PR applied:
**********************************************************************
1 item had failures:
1 of 2 in flint.types.acb.acb.pow
***Test Failed*** 1 failure and 18 skipped tests.
flint.test: all 62 tests passed!
flint.test: 1 of 3073 doctests failed
----------------------------------------
The one remaining failure is
**********************************************************************
File "/builddir/python3-flint-0.8.0/.xbps-testdir/1756942764/usr/lib/python3.13/site-packages/flint/types/acb.cpython-313-i386-linux-gnu.so", line 529, in flint.types.acb.acb.pow
Failed example:
acb.integral(lambda z, a: z.pow(acb("1/3"), analytic=a), -5-1j, -5+1j)
Expected:
[+/- 2.66e-14] + [1.8108516218463 +/- 3.58e-14]j
Got:
[+/- 2.71e-14] + [1.8108516218463 +/- 3.58e-14]j
Thanks. That test can be skipped as well. Both outputs are fine.
There needs to be a better way of testing arb outputs than using doctests like this. It is good to have a doctest that shows how the output actually looks but this kind of test is too fragile and can break in different FLINT versions or in this case in 32-bit vs 64-bit.
I've set that test to be skipped in d5c40a4c7ae088caba2ffab5ad79cdd4f41ad505 so current main should have passing tests for i686.
The fact that that test passes on wasm32 but still fails on i686 means that testing wasm32 is not good enough as a proxy for testing on a 32 bit system. Probably something with qemu should be used.
Thanks. Just guessing: maybe wasm32 uses float64 but i686 uses float80. Hence this might go away if flintlib were compiled with -mfpmath=sse or similar. We don't do that because supposedly we support i686 without sse in void linux.