diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx index 1e4e4fb0aa9..7d290fa4a2a 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx @@ -349,6 +349,8 @@ cdef class CombinatorialPolyhedron(SageObject): # ``self._length_edges_list*2*sizeof(size_t *)``. self._length_edges_list = 16348 + data_modified = None + if isinstance(data, Polyhedron_base): # input is ``Polyhedron`` Vrep = data.Vrepresentation() @@ -361,7 +363,14 @@ cdef class CombinatorialPolyhedron(SageObject): else: self._bounded = True + P = data data = data.incidence_matrix() + + # Delete equations + if P.n_equations(): + data_modified = data.delete_columns([e.index() for e in P.equations()]) + else: + data_modified = data elif isinstance(data, LatticePolytopeClass): # input is ``LatticePolytope`` self._bounded = True @@ -440,8 +449,10 @@ cdef class CombinatorialPolyhedron(SageObject): data.set_immutable() self.incidence_matrix.set_cache(data) - # Delete equations. - data_modified = data.delete_columns([i for i in range(data.ncols()) if all(data[j,i] for j in range(data.nrows()))], check=False) + + if data_modified is None: + # Delete equations. + data_modified = data.delete_columns([i for i in range(data.ncols()) if all(data[j,i] for j in range(data.nrows()))], check=False) # Initializing the facets in their Bit-representation. self._bitrep_facets = incidence_matrix_to_bit_rep_of_facets(data_modified) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx index 02e1261d45f..af1eb981abc 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx @@ -318,7 +318,7 @@ def incidence_matrix_to_bit_rep_of_facets(Matrix_integer_dense matrix): # Filling each facet with its Vrep-incidences, which "is" the # "i-th column" of the original matrix (but we have transposed). for entry in range(nrows): - if matrix.get_unsafe_double(entry, i): + if not matrix.get_is_zero_unsafe(entry, i): # Vrep ``entry`` is contained in the face, so set the corresponding bit value = entry % 64 position = entry//64