Skip to content

Commit 8119b56

Browse files
author
Jake Moss
committed
Doc fixes and typos in coerce_to_context
1 parent c731189 commit 8119b56

5 files changed

Lines changed: 15 additions & 13 deletions

File tree

src/flint/flint_base/flint_base.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ cdef class flint_mpoly(flint_elem):
987987
mapping = ctx.infer_generator_mapping(other_ctx)
988988
else:
989989
mapping = {
990-
ctx.variable_to_index(k): ctx.variable_to_index(v)
990+
ctx.variable_to_index(k): other_ctx.variable_to_index(v)
991991
for k, v in mapping.items()
992992
}
993993

@@ -996,7 +996,7 @@ cdef class flint_mpoly(flint_elem):
996996
if c_mapping is NULL:
997997
raise MemoryError("malloc returned a null pointer")
998998

999-
for i in range(self.ctx.nvars()):
999+
for i in range(ctx.nvars()):
10001000
c_mapping[i] = <slong>-1
10011001

10021002
for k, v in mapping.items():

src/flint/types/fmpq_mpoly.pyx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,9 +702,11 @@ cdef class fmpq_mpoly(flint_mpoly):
702702
Return a dictionary of variable name to degree.
703703
704704
>>> ctx = fmpq_mpoly_ctx.get(('x', 4), 'lex')
705-
>>> p = ctx.from_dict({(1, 0, 0, 0): 1, (0, 2, 0, 0): 2, (0, 0, 3, 0): 3})
705+
>>> p = sum(x**i for i, x in enumerate(ctx.gens()))
706+
>>> p
707+
x1 + x2^2 + x3^3 + 1
706708
>>> p.degrees()
707-
(1, 2, 3, 0)
709+
(0, 1, 2, 3)
708710
"""
709711
cdef:
710712
slong nvars = self.ctx.nvars()

src/flint/types/fmpz_mod_mpoly.pyx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,9 +707,11 @@ cdef class fmpz_mod_mpoly(flint_mpoly):
707707
Return a dictionary of variable name to degree.
708708
709709
>>> ctx = fmpz_mod_mpoly_ctx.get(('x', 4), 11, 'lex')
710-
>>> p = ctx.from_dict({(1, 0, 0, 0): 1, (0, 2, 0, 0): 2, (0, 0, 3, 0): 3})
710+
>>> p = sum(x**i for i, x in enumerate(ctx.gens()))
711+
>>> p
712+
x1 + x2^2 + x3^3 + 1
711713
>>> p.degrees()
712-
(1, 2, 3, 0)
714+
(0, 1, 2, 3)
713715
"""
714716
cdef:
715717
slong nvars = self.ctx.nvars()

src/flint/types/fmpz_mpoly.pyx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ cdef class fmpz_mpoly(flint_mpoly):
692692
Return a tuple of degrees.
693693
694694
>>> ctx = fmpz_mpoly_ctx.get(('x', 4), 'lex')
695-
>>> p = sum(x**(2 * i) for i, x in enumerate(ctx.gens()))
695+
>>> p = sum(x**i for i, x in enumerate(ctx.gens()))
696696
>>> p
697697
x1 + x2^2 + x3^3 + 1
698698
>>> p.degrees()
@@ -961,10 +961,6 @@ cdef class fmpz_mpoly(flint_mpoly):
961961
(<fmpz_mpoly_ctx>ctx).val
962962
)
963963

964-
if not fmpz_mpoly_is_canonical(res.val, res.ctx.val):
965-
fmpz_mpoly_sort_terms(res.val, res.ctx.val)
966-
fmpz_mpoly_combine_like_terms(res.val, res.ctx.val)
967-
968964
return res
969965

970966
def derivative(self, var):

src/flint/types/nmod_mpoly.pyx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,9 +687,11 @@ cdef class nmod_mpoly(flint_mpoly):
687687
Return a dictionary of variable name to degree.
688688
689689
>>> ctx = nmod_mpoly_ctx.get(('x', 4), 11, 'lex')
690-
>>> p = ctx.from_dict({(1, 0, 0, 0): 1, (0, 2, 0, 0): 2, (0, 0, 3, 0): 3})
690+
>>> p = sum(x**i for i, x in enumerate(ctx.gens()))
691+
>>> p
692+
x1 + x2^2 + x3^3 + 1
691693
>>> p.degrees()
692-
(1, 2, 3, 0)
694+
(0, 1, 2, 3)
693695
"""
694696
cdef:
695697
slong nvars = self.ctx.nvars()

0 commit comments

Comments
 (0)