Skip to content

Commit 9ec0bed

Browse files
committed
Fix polynomial sort comparison functions
1 parent 8493208 commit 9ec0bed

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/flint/types/fq_default_poly.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ cdef class _fq_default_poly_sort_key:
281281
fq_default_poly_get_coeff(c2.val, k2.p.val, i, field.val)
282282
if c1 != c2:
283283
j = d
284-
while j >= 0:
284+
while j > 0:
285285
j -= 1
286286
fq_default_get_coeff_fmpz(z1.val, c1.val, j, field.val)
287287
fq_default_get_coeff_fmpz(z2.val, c2.val, j, field.val)
@@ -290,7 +290,7 @@ cdef class _fq_default_poly_sort_key:
290290
else:
291291
raise RuntimeError("Bad cmp in _fq_default_poly_sort_key!")
292292
else:
293-
raise RuntimeError("Bad cmp in _fq_default_poly_sort_key!")
293+
return False
294294

295295

296296
cdef class fq_default_poly(flint_poly):

src/flint/types/nmod_poly.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ cdef class _nmod_poly_sort_key:
6969
elif k1.mult != k2.mult:
7070
return k1.mult < k2.mult
7171
i = k1.len
72-
while i >= 0:
72+
while i > 0:
7373
i -= 1
7474
c1 = nmod_poly_get_coeff_ui(k1.p.val, i)
7575
c2 = nmod_poly_get_coeff_ui(k2.p.val, i)
7676
if c1 != c2:
7777
return c1 < c2
7878
else:
79-
raise RuntimeError("Bad cmp in _nmod_poly_sort_key!")
79+
return False
8080

8181

8282
cdef class nmod_poly(flint_poly):

0 commit comments

Comments
 (0)