Skip to content

Commit

Permalink
Trac #33391: Remove compile dependency on flint from CombinatorialPol…
Browse files Browse the repository at this point in the history
…yhedron

As a preparation of #33385, we cimport from `Matrix_dense` instead of
`Matrix_integer_dense`. In particular this removes the compile time
dependency on flint.

URL: https://trac.sagemath.org/33391
Reported by: gh-kliem
Ticket author(s): Jonathan Kliem
Reviewer(s): Matthias Koeppe
  • Loading branch information
Release Manager committed Feb 27, 2022
2 parents 4761943 + 69ad1e0 commit 5f2efac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ from sage.geometry.polyhedron.base import Polyhedron_base
from sage.geometry.lattice_polytope import LatticePolytopeClass
from sage.geometry.cone import ConvexRationalPolyhedralCone
from sage.structure.element import Matrix
from sage.matrix.matrix_dense cimport Matrix_dense
from sage.misc.misc import is_iterator
from .conversions \
import incidence_matrix_to_bit_rep_of_facets, \
Expand All @@ -104,7 +105,6 @@ from sage.misc.cachefunc import cached_method

from sage.rings.integer cimport smallInteger
from cysignals.signals cimport sig_check, sig_block, sig_unblock
from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense

from .face_data_structure cimport face_len_atoms, face_init, face_free
from .face_iterator cimport iter_t, parallel_f_vector
Expand Down Expand Up @@ -455,11 +455,11 @@ cdef class CombinatorialPolyhedron(SageObject):
self._n_Hrepresentation = data.ncols()
self._n_Vrepresentation = data.nrows()

if not isinstance(data, Matrix_integer_dense):
if not isinstance(data, Matrix_dense):
from sage.rings.integer_ring import ZZ
from sage.matrix.constructor import matrix
data = matrix(ZZ, data, sparse=False)
assert isinstance(data, Matrix_integer_dense), "conversion to ``Matrix_integer_dense`` didn't work"
assert isinstance(data, Matrix_dense), "conversion to ``Matrix_dense`` didn't work"

# Store the incidence matrix.
if not data.is_immutable():
Expand Down Expand Up @@ -1126,7 +1126,7 @@ cdef class CombinatorialPolyhedron(SageObject):
"""
from sage.rings.integer_ring import ZZ
from sage.matrix.constructor import matrix
cdef Matrix_integer_dense incidence_matrix = matrix(
cdef Matrix_dense incidence_matrix = matrix(
ZZ, self.n_Vrepresentation(), self.n_Hrepresentation(), 0)

if self.dim() < 1:
Expand Down Expand Up @@ -1295,7 +1295,7 @@ cdef class CombinatorialPolyhedron(SageObject):
"""
from sage.rings.integer_ring import ZZ
from sage.matrix.constructor import matrix
cdef Matrix_integer_dense adjacency_matrix = matrix(
cdef Matrix_dense adjacency_matrix = matrix(
ZZ, self.n_Vrepresentation(), self.n_Vrepresentation(), 0)
cdef size_t i, a, b

Expand Down Expand Up @@ -1467,7 +1467,7 @@ cdef class CombinatorialPolyhedron(SageObject):
"""
from sage.rings.integer_ring import ZZ
from sage.matrix.constructor import matrix
cdef Matrix_integer_dense adjacency_matrix = matrix(
cdef Matrix_dense adjacency_matrix = matrix(
ZZ, self.n_facets(), self.n_facets(), 0)
cdef size_t i, a, b

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ AUTHOR:
from memory_allocator cimport MemoryAllocator

from sage.structure.element import is_Matrix
from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense
from sage.matrix.matrix_dense cimport Matrix_dense

from .list_of_faces cimport ListOfFaces
from .face_data_structure cimport face_next_atom, face_add_atom_safe, facet_set_coatom, face_clear
Expand Down Expand Up @@ -187,7 +187,7 @@ cdef int incidences_to_bit_rep(tuple incidences, face_t output) except -1:
# Vrep ``entry`` is contained in the face, so set the corresponding bit
face_add_atom_safe(output, entry)

def incidence_matrix_to_bit_rep_of_facets(Matrix_integer_dense matrix):
def incidence_matrix_to_bit_rep_of_facets(Matrix_dense matrix):
r"""
Initialize facets in Bit-representation as :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces`.
Expand All @@ -196,7 +196,7 @@ def incidence_matrix_to_bit_rep_of_facets(Matrix_integer_dense matrix):
- ``matrix`` -- an incidence matrix as in
:meth:`sage.geometry.polyhedron.base.Polyhedron_base.incidence_matrix`
with columns corresponding to equations deleted
of type :class:`sage.matrix.matrix_integer_dense.Matrix_integer_dense`
of type :class:`sage.matrix.matrix_dense.Matrix_dense`
OUTPUT:
Expand Down Expand Up @@ -251,7 +251,7 @@ def incidence_matrix_to_bit_rep_of_facets(Matrix_integer_dense matrix):
face_add_atom_safe(output, entry)
return facets

def incidence_matrix_to_bit_rep_of_Vrep(Matrix_integer_dense matrix):
def incidence_matrix_to_bit_rep_of_Vrep(Matrix_dense matrix):
r"""
Initialize Vrepresentatives in Bit-representation as :class:`~sage.geometry.polyhedron.combinatorial_polyhedron.list_of_faces.ListOfFaces`.
Expand All @@ -263,7 +263,7 @@ def incidence_matrix_to_bit_rep_of_Vrep(Matrix_integer_dense matrix):
- ``matrix`` -- an incidence matrix as in
:meth:`sage.geometry.polyhedron.base.Polyhedron_base.incidence_matrix`
with columns corresponding to equations deleted
of type :class:`sage.matrix.matrix_integer_dense.Matrix_integer_dense`
of type :class:`sage.matrix.matrix_dense.Matrix_dense`
OUTPUT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ AUTHOR:
# ****************************************************************************

from sage.structure.element import is_Matrix
from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense
from sage.matrix.matrix_dense cimport Matrix_dense

from .face_list_data_structure cimport *

Expand Down Expand Up @@ -503,7 +503,7 @@ cdef class ListOfFaces:
"""
from sage.rings.integer_ring import ZZ
from sage.matrix.constructor import matrix
cdef Matrix_integer_dense M = matrix(
cdef Matrix_dense M = matrix(
ZZ, self.n_faces(), self.n_atoms(), 0)

cdef size_t i
Expand Down

0 comments on commit 5f2efac

Please sign in to comment.