Closed kliem closed 3 years ago
Failing doctests.
Branch pushed to git repo; I updated commit sha1. New commits:
eb6046e | improved documentation and fixed error |
Possibly it might make sense to factor this ticket in two:
bitset_intrinsics.h
.Branch pushed to git repo; I updated commit sha1. New commits:
4362e2c | use enum to make code a bit more canonical |
Branch pushed to git repo; I updated commit sha1. New commits:
fc0f1d9 | resolve slow down comparison |
Description changed:
---
+++
@@ -75,37 +75,37 @@
sage: P1 = P.stack(next(P.face_generator(1)))
sage: C = CombinatorialPolyhedron(P1)
sage: %time C.f_vector()
-CPU times: user 1.71 s, sys: 0 ns, total: 1.71 s
-Wall time: 1.71 s
+CPU times: user 1.67 s, sys: 0 ns, total: 1.67 s
+Wall time: 1.66 s
(1, 16385, 131069, 487383, 1117948, 1769482, 2047331, 1788501, 1200342, 622908, 248963, 75361, 16640, 2470, 197, 1)
sage: P = polytopes.hypercube(15)
sage: P1 = P.stack(next(P.face_generator(1)))
sage: C = CombinatorialPolyhedron(P1)
sage: %time C.f_vector()
-CPU times: user 7.54 s, sys: 4 ms, total: 7.54 s
-Wall time: 7.54 s
+CPU times: user 7.28 s, sys: 8 ms, total: 7.28 s
+Wall time: 7.28 s
(1, 32769, 278525, 1105876, 2723539, 4657926, 5866861, 5629624, 4196907, 2454738, 1128127, 404404, 110929, 22386, 3059, 226, 1)
sage: P = polytopes.permutahedron(6)
sage: P1 = P.stack(next(P.face_generator(1)))
sage: C = CombinatorialPolyhedron(P1)
sage: %time C.f_vector()
-CPU times: user 1.45 ms, sys: 0 ns, total: 1.45 ms
-Wall time: 1.55 ms
+CPU times: user 1.44 ms, sys: 79 µs, total: 1.52 ms
+Wall time: 1.52 ms
(1, 721, 1987, 1956, 808, 120, 1)
sage: P = polytopes.permutahedron(7)
sage: P1 = P.stack(next(P.face_generator(1)))
sage: C = CombinatorialPolyhedron(P1)
sage: %time C.f_vector()
-CPU times: user 20.8 ms, sys: 27 µs, total: 20.8 ms
-Wall time: 20.7 ms
+CPU times: user 20.8 ms, sys: 0 ns, total: 20.8 ms
+Wall time: 20.9 ms
(1, 5041, 16251, 19761, 11144, 2860, 267, 1)
sage: P = polytopes.permutahedron(8, backend='normaliz')
sage: P1 = P.stack(next(P.face_generator(1)))
sage: C = CombinatorialPolyhedron(P1)
sage: %time C.f_vector()
-CPU times: user 665 ms, sys: 4 µs, total: 665 ms
-Wall time: 664 ms
+CPU times: user 616 ms, sys: 8 ms, total: 624 ms
+Wall time: 623 ms
(1, 40321, 148899, 215690, 154215, 56022, 9489, 572, 1)
# No change for simplicial/simple polytopes.
Cleaner code makes things a bit faster, I suppose.
Branch pushed to git repo; I updated commit sha1. New commits:
b3212d0 | two mistakes with no intrinsics |
All doctests pass on my side. With the current setup:
geometry/polyhedron
and data_structure/
tested)LGTM.
Reviewer: Travis Scrimshaw
Thank you.
Changed branch from u/gh-kliem/small_improvements_for_sparse_bitsets to b3212d0
For very large and challenging computations, most of the elements of the face lattice contain rather few atoms/bits. With little changes to the code, we can just collect the non zero chunks (64,128 or 256 bits).
RoaringBitmap performs better (starting with maybe 100,000 bits, but not with less, as container contain 64k bits), but that would add an extra dependency and make things more complicated.
To avoid code duplications, we also gather some functions in
bitset_intrinsics.h
that work just the same (e.g. intersection and union). (This actually accounts for most changes by this ticket.)Before (on #27103):
After:
This is the last subsequent improvement in comparison to sage 8.9 mentioned in https://arxiv.org/abs/1905.01945.
Follow ups:
geometry/polyhedron/combinatorial_polyhedron
to a more general location.face
->element
.Depends on #27103
CC: @stumpc5 @tscrim
Component: geometry
Keywords: combinatorial polyhedron, sparse bitsets
Author: Jonathan Kliem
Branch/Commit:
b3212d0
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/31262