my floating point looks wrong

41 views
Skip to first unread message

Vincent Delecroix

unread,
Oct 16, 2021, 3:33:06 AMOct 16
to sage-devel
Dear all,

I have a lot of doctest failures on a freshly compiled
sage 9.5.beta3. All seem related to double precision issues
(see below). The machine is a VM with a Debian bullseye. My
hope was to install a patchbot on this machine but it is
hopeless at the moment. If anybody has an idea of the source
of the trouble...

Vincent

PS: a bit on the machine

$ uname -a
Linux labri-vindelecroix-1 5.10.0-8-amd64 #1 SMP Debian 5.10.46-5
(2021-09-23) x86_64 GNU/Linux

$ python3
>>> import platform, sys
>>> print(sys.maxsize, platform.architecture())'
9223372036854775807 ('64bit', 'ELF')


PPS: complete list of test failures

Using --optional=argcomplete,build,debian,dochtml,pip,sage,sage_spkg


sage -t --long --random-seed=0 src/sage/geometry/polyhedron/base.py
**********************************************************************
File "src/sage/geometry/polyhedron/base.py", line 8677, in
sage.geometry.polyhedron.base.Polyhedron_base.volume
Failed example:
w = Dinexact.faces(2)[2].as_polyhedron().volume(measure='induced',
engine='internal'); RDF(w) # abs tol 1e-9
Expected:
1.5340627082974878
Got:
8.032456584010367
Tolerance exceeded:
1.5340627082974878 vs 8.032456584010367, tolerance 7e0 > 1e-9
**********************************************************************
1 item had failures:
1 of 46 in sage.geometry.polyhedron.base.Polyhedron_base.volume
[1758 tests, 1 failure, 34.59 s]


sage -t --long --random-seed=0 src/sage/geometry/polyhedron/library.py
**********************************************************************
File "src/sage/geometry/polyhedron/library.py", line 2479, in
sage.geometry.polyhedron.library.Polytopes.hypersimplex
Failed example:
TestSuite(h_7_3).run(skip=["_test_pyramid", "_test_lawrence"])
Expected nothing
Got:
Failure in _test_linear_transformation:
Traceback (most recent call last):
File
"/home/debian/sage/local/lib/python3.9/site-packages/sage/misc/sage_unittest.py",
line 297, in run
test_method(tester=tester)
File
"/home/debian/sage/local/lib/python3.9/site-packages/sage/geometry/polyhedron/base.py",
line 5504, in _test_linear_transformation
tester.assertEqual(self,
self.linear_transformation(identity_matrix(self.ambient_dim())))
File
"/home/debian/sage/local/lib/python3.9/site-packages/sage/geometry/polyhedron/base.py",
line 5481, in linear_transformation
return new_parent.element_class(new_parent, [new_vertices,
new_rays, new_lines],
File
"/home/debian/sage/local/lib/python3.9/site-packages/sage/geometry/polyhedron/backend_cdd.py",
line 540, in __init__
Polyhedron_cdd.__init__(self, parent, Vrep, Hrep, **kwds)
File
"/home/debian/sage/local/lib/python3.9/site-packages/sage/geometry/polyhedron/base.py",
line 236, in __init__
self._init_from_Vrepresentation_and_Hrepresentation(Vrep, Hrep)
File
"/home/debian/sage/local/lib/python3.9/site-packages/sage/geometry/polyhedron/backend_cdd.py",
line 666, in _init_from_Vrepresentation_and_Hrepresentation
try_init(prim)
File
"/home/debian/sage/local/lib/python3.9/site-packages/sage/geometry/polyhedron/backend_cdd.py",
line 641, in try_init
s = self._run_cdd(s, '--repall', verbose=verbose)
File
"/home/debian/sage/local/lib/python3.9/site-packages/sage/geometry/polyhedron/backend_cdd.py",
line 169, in _run_cdd
raise ValueError(ans.strip())
ValueError: *Error: Numerical inconsistency is found. Use the GMP
exact arithmetic.
------------------------------------------------------------
The following tests failed: _test_linear_transformation
**********************************************************************
1 item had failures:
1 of 9 in sage.geometry.polyhedron.library.Polytopes.hypersimplex
[307 tests, 1 failure, 33.43 s]


File "src/sage/matrix/matrix_double_dense.pyx", line 1365, in
sage.matrix.matrix_double_dense.Matrix_double_dense.?
Failed example:
A.eigenvalues(algorithm='symmetric', tol=1.0e-5) # tol 2e-15
Expected:
[(-8.0, 22), (2.0, 77), (22.0, 1)]
Got:
[(-13.81753974166025, 1),
(-13.648124559508018, 1),
(-12.020844694797459, 1),
(-11.501673730831273, 1),
...
(12.961615404888553, 1),
(17.06551630288574, 1),
(21.999999999999986, 1)]
**********************************************************************
2 items had failures:
1 of 49 in sage.matrix.matrix_double_dense.Matrix_double_dense.?
1 of 42 in
sage.matrix.matrix_double_dense.Matrix_double_dense.condition
[686 tests, 2 failures, 0.81 s]


sage -t --long --random-seed=0 src/sage/matrix/matrix_integer_dense.pyx
**********************************************************************
File "src/sage/matrix/matrix_integer_dense.pyx", line 3706, in
sage.matrix.matrix_integer_dense.Matrix_integer_dense.determinant
Failed example:
A.determinant(algorithm='linbox',proof=False) == d
Expected:
True
Got:
False
**********************************************************************
1 item had failures:
1 of 26 in
sage.matrix.matrix_integer_dense.Matrix_integer_dense.determinant
[648 tests, 1 failure, 11.39 s]


sage -t --long --random-seed=0 src/sage/stats/time_series.pyx
**********************************************************************
File "src/sage/stats/time_series.pyx", line 605, in
sage.stats.time_series.TimeSeries.autoregressive_fit
Failed example:
v.autoregressive_forecast(F)
Expected:
86.0177285042...
Got:
21.003854932876088
**********************************************************************
File "src/sage/stats/time_series.pyx", line 607, in
sage.stats.time_series.TimeSeries.autoregressive_fit
Failed example:
F
Expected:
[1.0148, -0.0029, -0.0105, 0.0067, -0.0232 ... -0.0106, -0.0068,
0.0085, -0.0131, 0.0092]
Got:
[0.7322, -0.0323, -19.7448, 21.0528, 0.5873 ... 0.0756, -0.1428,
0.1427, 0.0841, -0.0841]
**********************************************************************
File "src/sage/stats/time_series.pyx", line 2653, in
sage.stats.time_series.autoregressive_fit
Failed example:
F = stats.autoregressive_fit(ac); F
Expected:
[0.9982, -0.0002, -0.0002, 0.0003, 0.0001 ... 0.0002, -0.0002,
-0.0000, -0.0002, -0.0014]
Got:
[267.4990, 274.5020, -432.7506, 63700.1887, -63597.3265 ... 0.0000,
-0.0000, 0.0090, -0.8238, 0.8136]
**********************************************************************
File "src/sage/stats/time_series.pyx", line 2658, in
sage.stats.time_series.autoregressive_fit
Failed example:
sum(F)
Expected:
0.99593284089454...
Got:
457.10700633078386
**********************************************************************
File "src/sage/stats/time_series.pyx", line 2670, in
sage.stats.time_series.autoregressive_fit
Failed example:
y2[:-1].autoregressive_forecast(F)
Expected:
6.7836741372407...
Got:
9923.19178130465
**********************************************************************
File "src/sage/stats/time_series.pyx", line 2676, in
sage.stats.time_series.autoregressive_fit
Failed example:
y2[:-1].autoregressive_forecast(y2[:-1].autoregressive_fit(len(y2)))
Expected:
6.770168705668...
Got:
-6.4024671052208e+29
**********************************************************************
File "src/sage/stats/time_series.pyx", line 2691, in
sage.stats.time_series.autoregressive_fit
Failed example:
s2/s1
Expected:
1.15464636102...
Got:
0.02051611790945569
**********************************************************************
File "src/sage/stats/time_series.pyx", line 2709, in
sage.stats.time_series.autoregressive_fit
Failed example:
s.mean()
Expected:
1.354073591877...
Got:
1.4409707249354073
**********************************************************************
2 items had failures:
2 of 16 in sage.stats.time_series.TimeSeries.autoregressive_fit
6 of 22 in sage.stats.time_series.autoregressive_fit
[345 tests, 8 failures, 3.35 s]

Vincent Delecroix

unread,
Oct 16, 2021, 3:36:49 AMOct 16
to sage-devel
PPPS: And attached is the content of /proc/cpuinfo
cpuinfo

Dima Pasechnik

unread,
Oct 16, 2021, 5:13:09 AMOct 16
to sage-devel
this appears to trace back to scipy. Here is the test:

   An (extreme) example of properly grouping similar eigenvalues.

      sage: G = graphs.HigmanSimsGraph()
      sage: A = G.adjacency_matrix().change_ring(RDF)
      sage: A.eigenvalues(algorithm='symmetric', tol=1.0e-5)  # tol 2e-15

      [(-8.0, 22), (2.0, 77), (22.0, 1)]

'symmetric' simply forwards to 'hermitean'

     * "'symmetric'" - converts the matrix into a real matrix (i.e.
       with entries from "RDF"), then applies the algorithm for
       Hermitian matrices.  This algorithm can be significantly faster
       than the "'default'" algorithm.

     * "'hermitian'" - uses the "eigh()" method from SciPy, which
       applies only to real symmetric or complex Hermitian matrices.
       Since Hermitian is defined as a matrix equaling its conjugate-
       transpose, for a matrix with real entries this property is
       equivalent to being symmetric. This algorithm can be
       significantly faster than the "'default'" algorithm.

scipy then calls LAPACK (i.e. OpenBLAS), for dense matrices:

So you managed to build a busted version of SciPy, most probably.

HTH
Dima



--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/0b7ae26a-24a8-6453-597a-702267b4b367%40gmail.com.

Dima Pasechnik

unread,
Oct 16, 2021, 5:27:20 AMOct 16
to sage-devel
you may try newer OpenBLAS:

(make sure system's OpenBLAS is not used)

Matthias Koeppe

unread,
Oct 16, 2021, 1:49:56 PMOct 16
to sage-devel
I have reported this numerous times since at least 9.3.rc2

Vincent Delecroix

unread,
Oct 17, 2021, 6:28:15 AMOct 17
to sage-...@googlegroups.com
Thanks Matthias for the pointer!
>> 9923.19178130465 <(917)%20813-0465>
Reply all
Reply to author
Forward
0 new messages