@@ -93,11 +93,10 @@ from sage.geometry.cone import ConvexRationalPolyhedralCone
93
93
from sage.structure.element import Matrix
94
94
from sage.matrix.matrix_dense cimport Matrix_dense
95
95
from sage.misc.misc import is_iterator
96
- from .conversions \
97
- import incidence_matrix_to_bit_rep_of_facets, \
98
- incidence_matrix_to_bit_rep_of_Vrep, \
99
- facets_tuple_to_bit_rep_of_facets, \
100
- facets_tuple_to_bit_rep_of_Vrep
96
+ from .conversions import (incidence_matrix_to_bit_rep_of_facets,
97
+ incidence_matrix_to_bit_rep_of_Vrep,
98
+ facets_tuple_to_bit_rep_of_facets,
99
+ facets_tuple_to_bit_rep_of_Vrep)
101
100
from sage.geometry.polyhedron.combinatorial_polyhedron.conversions cimport Vrep_list_to_bit_rep
102
101
from sage.misc.cachefunc import cached_method
103
102
@@ -437,7 +436,7 @@ cdef class CombinatorialPolyhedron(SageObject):
437
436
from sage.matrix.constructor import matrix
438
437
from sage.rings.integer_ring import ZZ
439
438
incidence_matrix = matrix(ZZ, data.incidence_matrix().rows()
440
- + [[ZZ.one() for _ in range (len (data.facet_normals()))]])
439
+ + [[ZZ.one() for _ in range (len (data.facet_normals()))]])
441
440
return self ._init_from_incidence_matrix(incidence_matrix)
442
441
443
442
cdef _init_facet_names(self , facets) noexcept:
@@ -481,11 +480,10 @@ cdef class CombinatorialPolyhedron(SageObject):
481
480
data.set_immutable()
482
481
self .incidence_matrix.set_cache(data)
483
482
484
-
485
483
# Delete equations.
486
484
data = data.delete_columns(
487
485
[i for i in range (data.ncols())
488
- if all (data[j,i] for j in range (data.nrows()))],
486
+ if all (data[j, i] for j in range (data.nrows()))],
489
487
check = False )
490
488
491
489
# Initializing the facets in their Bit-representation.
@@ -515,7 +513,7 @@ cdef class CombinatorialPolyhedron(SageObject):
515
513
n_Vrepresentation = len (Vrep)
516
514
if Vrep != range (len (Vrep)):
517
515
self ._Vrep = tuple (Vrep)
518
- Vinv = {v: i for i,v in enumerate (self ._Vrep)}
516
+ Vinv = {v: i for i, v in enumerate (self ._Vrep)}
519
517
else :
520
518
# Assuming the user gave as correct names for the vertices
521
519
# and labeled them instead by `0,...,n`.
@@ -548,7 +546,7 @@ cdef class CombinatorialPolyhedron(SageObject):
548
546
Initialize self from two ``ListOfFaces``.
549
547
"""
550
548
self ._bitrep_facets = facets
551
- self ._bitrep_Vrep = Vrep
549
+ self ._bitrep_Vrep = Vrep
552
550
553
551
self ._n_Hrepresentation = self ._bitrep_facets.n_faces()
554
552
self ._n_Vrepresentation = self ._bitrep_Vrep.n_faces()
@@ -629,7 +627,7 @@ cdef class CombinatorialPolyhedron(SageObject):
629
627
'A 2-dimensional combinatorial polyhedron with 1 facet'
630
628
"""
631
629
desc = " A {}-dimensional combinatorial polyhedron with {} facet" \
632
- .format(self .dimension(), self .n_facets())
630
+ .format(self .dimension(), self .n_facets())
633
631
if self .n_facets() != 1 :
634
632
desc += " s"
635
633
return desc
@@ -1694,7 +1692,7 @@ cdef class CombinatorialPolyhedron(SageObject):
1694
1692
1695
1693
if not names:
1696
1694
vertices = [i for i in range (n_facets + n_Vrep)]
1697
- edges = tuple ((j, n_Vrep + n_facets - 1 - i) for i,facet in enumerate (facet_iter) for j in facet.ambient_V_indices())
1695
+ edges = tuple ((j, n_Vrep + n_facets - 1 - i) for i, facet in enumerate (facet_iter) for j in facet.ambient_V_indices())
1698
1696
else :
1699
1697
facet_names = self .facet_names()
1700
1698
if facet_names is None :
@@ -1707,7 +1705,7 @@ cdef class CombinatorialPolyhedron(SageObject):
1707
1705
Vrep = [(" V" , i) for i in range (n_Vrep)]
1708
1706
1709
1707
vertices = Vrep + facet_names
1710
- edges = tuple ((Vrep[j], facet_names[n_facets - 1 - i]) for i,facet in enumerate (facet_iter) for j in facet.ambient_V_indices())
1708
+ edges = tuple ((Vrep[j], facet_names[n_facets - 1 - i]) for i, facet in enumerate (facet_iter) for j in facet.ambient_V_indices())
1711
1709
return DiGraph([vertices, edges], format = ' vertices_and_edges' , immutable = True )
1712
1710
1713
1711
@cached_method
@@ -2126,7 +2124,7 @@ cdef class CombinatorialPolyhedron(SageObject):
2126
2124
cdef simpliciality = dim - 1
2127
2125
2128
2126
# For each face in the iterator, check if its a simplex.
2129
- face_iter.structure.lowest_dimension = 2 # every 1-face is a simplex
2127
+ face_iter.structure.lowest_dimension = 2 # every 1-face is a simplex
2130
2128
d = face_iter.next_dimension()
2131
2129
while d < dim:
2132
2130
sig_check()
@@ -2237,7 +2235,7 @@ cdef class CombinatorialPolyhedron(SageObject):
2237
2235
cdef simplicity = dim - 1
2238
2236
2239
2237
# For each coface in the iterator, check if its a simplex.
2240
- coface_iter.structure.lowest_dimension = 2 # every coface of dimension 1 is a simplex
2238
+ coface_iter.structure.lowest_dimension = 2 # every coface of dimension 1 is a simplex
2241
2239
d = coface_iter.next_dimension()
2242
2240
while d < dim:
2243
2241
sig_check()
@@ -2623,7 +2621,6 @@ cdef class CombinatorialPolyhedron(SageObject):
2623
2621
2624
2622
return (False , None )
2625
2623
2626
-
2627
2624
def join_of_Vrep (self , *indices ):
2628
2625
r """
2629
2626
Return the smallest face containing all Vrepresentatives indicated by the indices.
@@ -2793,7 +2790,6 @@ cdef class CombinatorialPolyhedron(SageObject):
2793
2790
if ' dual' in kwds and dual == - 1 and kwds[' dual' ] in (False , True ):
2794
2791
dual = int (kwds[' dual' ])
2795
2792
2796
- cdef FaceIterator face_iter
2797
2793
if dual == - 1 :
2798
2794
# Determine the faster way, to iterate through all faces.
2799
2795
if not self .is_bounded() or self .n_facets() <= self .n_Vrepresentation():
@@ -3354,7 +3350,6 @@ cdef class CombinatorialPolyhedron(SageObject):
3354
3350
and self .far_face_tuple() == other_C.far_face_tuple()
3355
3351
and self .incidence_matrix() == other.incidence_matrix())
3356
3352
3357
-
3358
3353
# Methods to obtain a different combinatorial polyhedron.
3359
3354
3360
3355
cpdef CombinatorialPolyhedron dual(self ) noexcept:
@@ -3484,7 +3479,6 @@ cdef class CombinatorialPolyhedron(SageObject):
3484
3479
3485
3480
return CombinatorialPolyhedron((new_facets, new_Vrep), Vrep = new_Vrep_names, facets = new_facet_names)
3486
3481
3487
-
3488
3482
# Internal methods.
3489
3483
3490
3484
cdef int _compute_f_vector(self , size_t num_threads, size_t parallelization_depth, int dual) except - 1 :
@@ -3497,7 +3491,6 @@ cdef class CombinatorialPolyhedron(SageObject):
3497
3491
return 0 # There is no need to recompute the f_vector.
3498
3492
3499
3493
cdef int dim = self .dimension()
3500
- cdef int d # dimension of the current face of the iterator
3501
3494
cdef MemoryAllocator mem = MemoryAllocator()
3502
3495
3503
3496
if num_threads == 0 :
@@ -3686,7 +3679,7 @@ cdef class CombinatorialPolyhedron(SageObject):
3686
3679
3687
3680
from sage.arith.misc import binomial
3688
3681
estimate_n_faces = self .dimension() * binomial(min (self .n_facets(), self .n_Vrepresentation()),
3689
- self .dimension() // 2 )
3682
+ self .dimension() // 2 )
3690
3683
3691
3684
# Note that the runtime per face already computes the coatoms of the next level, i.e.
3692
3685
# the runtime for each facet suffices to compute all ridges in primal,
0 commit comments