Skip to content

Commit 737d22c

Browse files
committed
Replace drop_unused_gens with unused_gens
1 parent 324f6ae commit 737d22c

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/flint/flint_base/flint_base.pyx

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -941,10 +941,9 @@ cdef class flint_mpoly(flint_elem):
941941
"""
942942
return zip(self.monoms(), self.coeffs())
943943

944-
def drop_unused_gens(self):
944+
def unused_gens(self):
945945
"""
946-
Remove unused generators from this polynomial. Returns a potentially new
947-
context, and potentially new polynomial.
946+
Report the unused generators from this polynomial.
948947
949948
A generator is unused if it's maximum degree is 0.
950949
@@ -954,16 +953,11 @@ cdef class flint_mpoly(flint_elem):
954953
>>> f = sum(ctx.gens()[1:3])
955954
>>> f
956955
x1 + x2
957-
>>> new_ctx, new_f = f.drop_unused_gens()
958-
>>> new_ctx
959-
fmpz_mpoly_ctx(2, '<Ordering.lex: 'lex'>', ('x1', 'x2'))
960-
>>> new_f
961-
x1 + x2
956+
>>> f.unused_gens()
957+
('x0', 'x3')
962958
"""
963-
new_ctx = self.context().drop_gens(
964-
*(i for i, x in enumerate(self.degrees()) if not x)
965-
)
966-
return new_ctx, self.coerce_to_context(new_ctx)
959+
names = self.context().names()
960+
return tuple(names[i] for i, x in enumerate(self.degrees()) if not x)
967961

968962
def project_to_context(self, other_ctx, mapping: dict[str | int, str | int] = None):
969963
"""

0 commit comments

Comments
 (0)