sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.22k stars 424 forks source link

Implement the class CombinatorialPolyhedron #26887

Closed kliem closed 5 years ago

kliem commented 5 years ago

We construct a class CombinatorialPolyhedron, which collects several methods for polyhedra depending only on the combinatorial type. Actually, most of the methods will work for atomic, coatomic Eulerian lattices.

Computations can be much faster when avoiding creating explicitly the face lattice.

Example:

P = polytopes.permutahedron(6)
P.f_vector()

On my machine this takes over 8s, but it should be a matter of ms. For permutahedron(7) it takes forever and should also be a matter of ms.

Additionally, one can create the face_lattice much faster. The face_lattice of permutahedron(7) should only take few seconds. This is done by creating of lists of all faces and then quickly checking inclusions.

The crucial speed up is obtained by creating bit-vectors for the faces, each bit corresponding to a vertex. Intersection of faces is then only bitwise-and and subset check is (A & ~B == 0). Both steps only take one CPU step per 64/128/256 bits/vertices (depending on the processor). Otherwise the algorithm is pretty similar to current algorithm to create the hasse_diagram, except that it avoids double counting (and hence can calculate the f_vector) without an explicit list of all faces.

The ticket will prepare, but not use, SIMD-instructions. Enabling them will be a subject of #27103.

FOLLOW-UPS:

CC: @stumpc5 @jplab @tscrim

Component: geometry

Keywords: polytopes, FindPoly, f_vector, face lattice, edge graph, ridge graph

Author: Jonathan Kliem

Branch: 39a7099

Reviewer: Jeroen Demeyer, Travis Scrimshaw, Vincent Delecroix

Issue created by migration from https://trac.sagemath.org/ticket/26887

kliem commented 5 years ago

Branch: u/gh-kliem/improve_f_vector_etc__for_polytopes

fchapoton commented 5 years ago

Commit: d0dba61

fchapoton commented 5 years ago
comment:2

the branch is almost empty (no meaningful changes)


New commits:

d0dba61first push test
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from d0dba61 to 3f1600e

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

a596e0cCreated a class CombinatorialType which is a wrapper for a cpp class
3f1600eadded the files
kliem commented 5 years ago

Author: Jonathan Kliem

kliem commented 5 years ago

Changed keywords from polytopes, FindPoly to polytopes, FindPoly, f_vector, face_lattic

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 3f1600e to 03fe21f

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

3b10c24moved the files to the polyhedron folder
03fe21fadded the new files
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

99eda99Before Renaming CombinatorialType to CombinatorialPolytope
7efe6a2After Renaming CombinatorialType to CombinatorialPolytope
24949d9This should be mostly done now. Some minor changes are missing, also documentation needs to be done'
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 03fe21f to 24949d9

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 24949d9 to 8c5d21a

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

8c5d21asome minor changes
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 8c5d21a to a63c68f

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

a63c68fPreparing a function to get all k-faces
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from a63c68f to 580980b

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

580980bsome work on generating all k-faces of the polyhedron
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

591ed26hasse_diagram is mostly working now, it is much faster than the old hasse_diagram of polyhedron
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 580980b to 591ed26

kliem commented 5 years ago

Description changed:

--- 
+++ 
@@ -1,4 +1,6 @@
 Several improvements for calculating properties of polytopes that depend on the face-lattice.
+
+We will construct a class CombinatorialPolytope, which will collect several methods for polyhedra depending only on the combinatorial type. Actually, most of the methods will work for atomic, coatimic Eulerian lattices.

 Computations can be much faster when avoiding creating explicitly the face lattice.

@@ -7,3 +9,9 @@
 P.f_vector()

 At my machine this takes over 8s, but it should be a matter of ms. For permutahedron(7) it takes forever and should also be a matter of ms.
+
+Additionally, one can create the face_lattice much faster. The face_lattice of permutahedron(7) should only take few seconds. This is done by creating of lists of all faces and then quickly checking inclusions.
+
+The crucial speed up is obtained by creating bit-vectors for the faces, each bit corresponding to a vertex. Intersection of faces is then only bitwise-and and subset check is (A & ~B == 0). Both steps only take one CPU step per 64/128/256 bits/vertices (depending on the processor). Otherwise the algorithm is pretty similar to current algorithm to create the hasse_diagram, except that it avoids double counting (and hence can calculate the f_vector) without an explicit list of all faces.
+
+It might also make sense to improve calculation of entries in the flag-vector, while we are at it. This takes for every entry in the flag-vector less time then to construct the face-lattice.
kliem commented 5 years ago

Changed keywords from polytopes, FindPoly, f_vector, face_lattic to polytopes, FindPoly, f_vector, face lattice, flag vector, edge graph, ridge grapg

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

576905dflag vectors seem to work now
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 591ed26 to 576905d

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

4a41711changed the name from CombinatorialPolytope to CombinatorialPolyhedron
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 576905d to 4a41711

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 4a41711 to e345470

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

e345470This should be ready for review
kliem commented 5 years ago
comment:19

I'm not experienced at what point a ticket should change its status to "needs review". Of course there is still stuff that I can do by myself like documentation and comments.

I would definitely be grateful for comments and help at this point. At this point everything should work at least I'm not aware of any bugs.

videlec commented 5 years ago
comment:20

As a start you can write examples (see the developer guide).

Next, it is not a very often not a good idea to write Python in C. It is hard to read and often difficult to do right (e.g. check memory allocation, ensure compatibility Python2/Python3). You should use Cython for that purpose, unless there is a very good reason for that.

As you use advanced CPU instructions you should check very carefully that your code does work on all architectures (ie Intel since Pentium II as well as AMD).

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

d897cd1Added Examples, also fixed the empty Polyhedron
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from e345470 to d897cd1

kliem commented 5 years ago
comment:22

I added examples.

I tried Cython, but didn't get the desired speedup. It was much faster than what is implemented in Polyhedron though. I started doing it in cython, but I couldn't get array access (via pointers) in a speed even close to C. Now with using intrinsics I'm close to 4 times as fast then without intrinsics. The crucial step in the algorithm is subset check as A & ~B == 0 for long bit vectors A and B.

We want to build a Database for Polytopes (similar to FindStat) and thus we want to be able to fastly compute f_vectors even for large polytopes. This is the f_vector of a 20-dimensional counter example to the Hirsch conjecture. It only takes about 3 minutes to calculate now:

(1, 36425, 364250, 1846226, 6234909, 15556845, 30191256, 46918071, 59410131, 61931131, 53428829, 38194318, 22569116, 10954980, 4322157, 1364130, 336525, 62752, 8419, 754, 40, 1)

In Cython I was able to calculate this vector (or more important the edge graph) in something like 3 hours, in C it took me 20 minutes. Then I started doing bitwise operations and intrinsics and it is now down to 3 minutes with AVX2.

As for the CPU instructions: I'm prechecking the compiler flags. So if nothing works it just falls back to computing with uint64_t which should work on any machine.

As for memory leaks: It seems to work fine now. Python calls the dealloc() function at closup and when deleting the class and clears all the alloced memeory in C.

Replying to @videlec:

As a start you can write examples (see the developer guide).

Next, it is not a very often not a good idea to write Python in C. It is hard to read and often difficult to do right (e.g. check memory allocation, ensure compatibility Python2/Python3). You should use Cython for that purpose, unless there is a very good reason for that.

As you use advanced CPU instructions you should check very carefully that your code does work on all architectures (ie Intel since Pentium II as well as AMD).

videlec commented 5 years ago
comment:23

Replying to @kliem:

I added examples.

I tried Cython, but didn't get the desired speedup.

That means that you don't know how to use Cython. Any C code can be written in plain Cython. Though I never said that you should rewrite everything using Cython. I am sorry if it was unclear. I adviced you to to rewrite the Python <-> C gluing part. More precisely, the C code would better not involve any Python at all. And you may write an independent Cython file that will call the C code appropriately.

kliem commented 5 years ago
comment:24

Replying to @videlec:

Replying to @kliem:

I added examples.

I tried Cython, but didn't get the desired speedup.

That means that you don't know how to use Cython. Any C code can be written in plain Cython.

That is correct. I'm mostly happy if anything works at all. Once this is the case, I try to make it somewhat nice. It looked to me as if one was supposed to use memoryviews in Cython. They where the fastest working with plain C arrays. But then I couldn't initialize an array in a size determined at runtime. Anyway, as I understand having the code in C is not the problem here.

Though I never said that you should rewrite everything using Cython. I am sorry if it was unclear. I adviced you to to rewrite the Python <-> C gluing part. More precisely, the C code would better not involve any Python at all. And you may write an independent Cython file that will call the C code appropriately.

This sounds very reasonable. I will do so. When I first started with this, I didn't use Cython in between, so my C code had to return a Python object. But it makes sense to build a Python object in an environment that was meant for this. Building tuples etc. was a pain in C and it did always feel like a workaround. I never gave it any second thought though.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from d897cd1 to bc21ffa

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

bc21ffaWork toward cleaing up the Python <-> C gluing part
videlec commented 5 years ago
comment:28

These doctests are not reproducible.

    sage: P = polytopes.permutahedron(6)
    sage: %time CombinatorialPolyhedron(P).face_lattice(vertices=False,facets=False)
    CPU times: user 400 ms, sys: 20 ms, total: 420 ms
    Wall time: 380 ms
    Finite lattice containing 4684 elements
    sage: %time CombinatorialPolyhedron(P).face_lattice(vertices=True,facets=True)
    CPU times: user 2.48 s, sys: 60 ms, total: 2.54 s
    Wall time: 2.4 s
    Finite lattice containing 4684 elements
    sage: %time CombinatorialPolyhedron(P).face_lattice(vertices=True,facets=False) #default
    CPU times: user 1.87 s, sys: 48 ms, total: 1.92 s
    Wall time: 1.76 s
    Finite lattice containing 4684 elements

You should check that tests pass using sage -t --long FILENAME.

videlec commented 5 years ago
comment:29

The function CombinatorialPolyhedron::get_flag_number(PyObject* py_tuple) and many others are very likely to crash Sage (e.g. you do not take care of any error handling). I strongly advice you to avoid any Python in C/C++. The conversion tuple -> C++ vector is very easily done in Cython which automatically handles conversions and errors.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

d20baa4Flag-vector: Fixed C <-> Python gluing
febaa72face and incidences: fixed Python <-> C gluing
152db94fixed Polyhedra with no facets
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from bc21ffa to 152db94

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

b78d533Initialization: Fixed Python <-> C gluing
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 152db94 to b78d533

jhpalmieri commented 5 years ago
comment:32

This doesn't build for me on OS X:

gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wno-unused -I./sage/geometry/polyhedron/combinatorial_polyhedron -I/Users/jpalmier/Desktop/Sage/git/sage/local/include -I/Users/jpalmier/Desktop/Sage/git/sage/local/include/python2.7 -I/Users/jpalmier/Desktop/Sage/git/sage/local/lib/python2.7/site-packages/numpy/core/include -I/Users/jpalmier/Desktop/Sage/git/sage/src -I/Users/jpalmier/Desktop/Sage/git/sage/src/sage/ext -Ibuild/cythonized -I/Users/jpalmier/Desktop/Sage/git/sage/local/include/python2.7 -c sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc -o build/temp.macosx-10.9-x86_64-2.7/sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.o -fno-strict-aliasing -DCYTHON_CLINE_IN_TRACEBACK=1 -I/Users/jpalmier/Desktop/Sage/git/sage/local/include/m4ri -I/Users/jpalmier/Desktop/Sage/git/sage/local/include -g -fPIC -Wall -O2 -mmmx -msse -msse2 -msse3 -O3 -march=native -std=c++11
In file included from sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:3:
In file included from /Users/jpalmier/Desktop/Sage/git/sage/local/include/python2.7/Python.h:88:
/Users/jpalmier/Desktop/Sage/git/sage/local/include/python2.7/unicodeobject.h:534:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register PyObject *obj,     /* Object */
    ^~~~~~~~~
/Users/jpalmier/Desktop/Sage/git/sage/local/include/python2.7/unicodeobject.h:553:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register PyObject *obj      /* Object */
    ^~~~~~~~~
/Users/jpalmier/Desktop/Sage/git/sage/local/include/python2.7/unicodeobject.h:575:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register const wchar_t *w,  /* wchar_t buffer */
    ^~~~~~~~~
/Users/jpalmier/Desktop/Sage/git/sage/local/include/python2.7/unicodeobject.h:593:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register wchar_t *w,        /* wchar_t buffer */
    ^~~~~~~~~
In file included from sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:3:
In file included from /Users/jpalmier/Desktop/Sage/git/sage/local/include/python2.7/Python.h:97:
/Users/jpalmier/Desktop/Sage/git/sage/local/include/python2.7/stringobject.h:173:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register PyObject *obj,     /* string or Unicode object */
    ^~~~~~~~~
/Users/jpalmier/Desktop/Sage/git/sage/local/include/python2.7/stringobject.h:174:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register char **s,          /* pointer to buffer variable */
    ^~~~~~~~~
/Users/jpalmier/Desktop/Sage/git/sage/local/include/python2.7/stringobject.h:175:5: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
    register Py_ssize_t *len    /* pointer to length variable or NULL
    ^~~~~~~~~
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:129:5: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
    delete(edges);
    ^
          []
./sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.h:95:32: note: allocated with 'new[]' here
        unsigned int **edges = new unsigned int *[maxnumberedges];
                               ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:130:5: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
    delete(ridges);
    ^
          []
./sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.h:96:33: note: allocated with 'new[]' here
        unsigned int **ridges = new unsigned int *[maxnumberedges];
                                ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:131:5: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
    delete(incidences);
    ^
          []
./sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.h:97:38: note: allocated with 'new[]' here
        unsigned long **incidences = new unsigned long *[maxnumberincidences]();
                                     ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:123:20: warning: unused variable 'j' [-Wunused-variable]
    unsigned int i,j;
                   ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:123:18: warning: unused variable 'i' [-Wunused-variable]
    unsigned int i,j;
                 ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:194:18: warning: unused variable 'dim' [-Wunused-variable]
    unsigned int dim = get_dimension();
                 ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:272:18: warning: unused variable 'dim' [-Wunused-variable]
    unsigned int dim = get_dimension();
                 ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:428:19: warning: unused variable 'n' [-Wunused-variable]
    unsigned long n;
                  ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:443:19: warning: unused variable 'n' [-Wunused-variable]
    unsigned long n;
                  ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:532:22: error: variable-sized object may not be initialized
    int addfacearray[lenfaces] = { };
                     ^~~~~~~~
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:585:32: error: use of undeclared identifier 'aligned_alloc'
        nextfaces_creator[i] = aligned_alloc(chunksize/8,length_of_face*chunksize/8);
                               ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:607:32: error: use of undeclared identifier 'aligned_alloc'
        nextfaces_creator[i] = aligned_alloc(chunksize/8,length_of_face*chunksize/8);
                               ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:655:20: warning: unused variable 'j' [-Wunused-variable]
    unsigned int i,j;
                   ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:689:20: warning: unused variable 'j' [-Wunused-variable]
    unsigned int i,j;
                   ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:733:5: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
    delete(array);
    ^
          []
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:722:23: note: allocated with 'new[]' here
    uint64_t *array = new uint64_t [size_array]();
                      ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:719:20: warning: unused variable 'j' [-Wunused-variable]
    unsigned int i,j;
                   ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:720:18: warning: unused variable 'entry' [-Wunused-variable]
    unsigned int entry, position, value;
                 ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:791:9: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
        delete(saverarray);
        ^
              []
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:773:34: note: allocated with 'new[]' here
    unsigned long **saverarray = new unsigned long *[const_len];
                                 ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:800:13: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
            delete(saverarray);
            ^
                  []
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:773:34: note: allocated with 'new[]' here
    unsigned long **saverarray = new unsigned long *[const_len];
                                 ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:834:5: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
    delete (saverarray);
    ^
          []
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:773:34: note: allocated with 'new[]' here
    unsigned long **saverarray = new unsigned long *[const_len];
                                 ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:883:9: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
        delete(old_facets_walker);
        ^
              []
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:867:43: note: allocated with 'new[]' here
        unsigned int *old_facets_walker = new unsigned int [size_three]();
                                          ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:967:5: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
    delete(array);
    ^
          []
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:954:23: note: allocated with 'new[]' here
    uint64_t *array = new uint64_t [size_array]();
                      ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:993:5: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
    delete(array);
    ^
          []
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:979:23: note: allocated with 'new[]' here
    uint64_t *array = new uint64_t [size_array]();
                      ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:1026:5: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
    delete(array);
    ^
          []
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:1014:23: note: allocated with 'new[]' here
    uint64_t *array = new uint64_t [size_array]();
                      ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:1049:5: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
    delete(array);
    ^
          []
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:1039:23: note: allocated with 'new[]' here
    uint64_t *array = new uint64_t [size_array]();
                      ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:1163:31: error: use of undeclared identifier 'aligned_alloc'
        facets_allocator[i] = aligned_alloc(chunksize/8,length_of_face*chunksize/8);
                              ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:1188:33: error: use of undeclared identifier 'aligned_alloc'
        vertices_allocator[i] = aligned_alloc(chunksize/8,length_of_face_in_facet_repr*chunksize/8);
                                ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:1220:40: error: use of undeclared identifier 'aligned_alloc'
            newfaces_allocator[i][j] = aligned_alloc(chunksize/8,length_of_face*chunksize/8);
                                       ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:1270:64: error: use of undeclared identifier 'aligned_alloc'
                allfaces_allocator[dimension_to_allocate][i] = aligned_alloc(chunksize/8,length_of_face*chunksize/8);
                                                               ^
sage/geometry/polyhedron/combinatorial_polyhedron/hasse_diagram.cc:1272:75: error: use of undeclared identifier 'aligned_alloc'
                allfaces_facet_repr_allocator[dimension_to_allocate][i] = aligned_alloc(chunksize/8,length_of_face_in_facet_repr*chunksize/8);
                                                                          ^
29 warnings and 8 errors generated.
kliem commented 5 years ago
comment:33

Thanks for going through the effort of building that on your machine.

It seems to me that there are the following issues:

Replying to @jhpalmieri:

This doesn't build for me on OS X:

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

73fac0eremoved Python in C, aligned_alloc should now work in C++17
2ffc402corrected deletion of arrays
dc0455dremoved unused variables, all errors and warnings reported by jhpalmieri should be gone now
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from b78d533 to dc0455d

kliem commented 5 years ago
comment:35

I should have checked first..., this doesn't work

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from dc0455d to 80f4e33

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

7557ecdfixing the calculation of the dimension
e32d0f6changed names of variables to not overload dimension of CombinatorialPolyhedron
80f4e33Fixed issue: edges, ridges and incidences should be initialized in order for delete to work properly
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 5 years ago

Changed commit from 80f4e33 to a89c37b