Skip to content

Commit 2367bc9

Browse files
committed
improvements suggested by reviewer
1 parent 1017ab7 commit 2367bc9

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/sage/data_structures/list_of_pairs.pyx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ cdef class ListOfPairs:
4141
self.length += 1
4242

4343
cdef inline pair_s* get(self, size_t index) except NULL:
44+
"""
45+
Return a pointer to a pair of the list corresponding to the ``index``.
46+
"""
4447
if not (0 <= index < self.length):
4548
raise IndexError
4649

@@ -100,7 +103,7 @@ cdef class ListOfPairs:
100103
cdef size_t first, second
101104
(first, second) = value
102105

103-
if (index == self.length):
106+
if index == self.length:
104107
self.add(first, second)
105108
return
106109

src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,18 +1461,15 @@ cdef class CombinatorialPolyhedron(SageObject):
14611461
cdef pair_s ridge
14621462

14631463
if add_equations and names:
1464-
def get_ridge(size_t i):
1465-
ridge = self._ridges.get(i)[0]
1466-
return ((f(ridge.first),) + self.equations(),
1467-
(f(ridge.second),) + self.equations())
1468-
1464+
return tuple(
1465+
((f(self._ridges.get(i)[0].first),) + self.equations(),
1466+
(f(self._ridges.get(i)[0].second),) + self.equations())
1467+
for i in range (n_ridges))
14691468
else:
1470-
def get_ridge(size_t i):
1471-
ridge = self._ridges.get(i)[0]
1472-
return (f(ridge.first), f(ridge.second))
1473-
1474-
cdef size_t j
1475-
return tuple(get_ridge(j) for j in range(n_ridges))
1469+
return tuple(
1470+
(f(self._ridges.get(i)[0].first),
1471+
f(self._ridges.get(i)[0].second))
1472+
for i in range (n_ridges))
14761473

14771474
@cached_method
14781475
def facet_adjacency_matrix(self, algorithm=None):
@@ -2110,7 +2107,7 @@ cdef class CombinatorialPolyhedron(SageObject):
21102107
# For each face in the iterator, check if its a simplex.
21112108
face_iter.structure.lowest_dimension = 2 # every 1-face is a simplex
21122109
d = face_iter.next_dimension()
2113-
while (d < dim):
2110+
while d < dim:
21142111
sig_check()
21152112
if face_iter.n_atom_rep() == d + 1:
21162113
# The current face is a simplex.
@@ -2221,7 +2218,7 @@ cdef class CombinatorialPolyhedron(SageObject):
22212218
# For each coface in the iterator, check if its a simplex.
22222219
coface_iter.structure.lowest_dimension = 2 # every coface of dimension 1 is a simplex
22232220
d = coface_iter.next_dimension()
2224-
while (d < dim):
2221+
while d < dim:
22252222
sig_check()
22262223
if coface_iter.n_atom_rep() == d + 1:
22272224
# The current coface is a simplex.
@@ -3721,13 +3718,13 @@ cdef class CombinatorialPolyhedron(SageObject):
37213718

37223719
dimension_one = 0
37233720
if dim > -1:
3724-
while (f_vector[dimension_one + 1] == 0):
3721+
while f_vector[dimension_one + 1] == 0:
37253722
# Taking care of cases, where there might be no faces
37263723
# of dimension 0, 1, etc (``n_lines > 0``).
37273724
dimension_one += 1
37283725
dimension_two = -1
37293726

3730-
while (dimension_one < dim + 1):
3727+
while dimension_one < dim + 1:
37313728
already_seen = sum(f_vector[j] for j in range(dimension_two + 1))
37323729
already_seen_next = already_seen + f_vector[dimension_two + 1]
37333730

0 commit comments

Comments
 (0)