@@ -17,7 +17,7 @@ from flint.types.fmpz_vec cimport fmpz_vec
1717from flint.types.fmpq_vec cimport fmpq_vec
1818
1919from flint.types.fmpz cimport fmpz, any_as_fmpz
20- from flint.types.fmpz_mpoly cimport fmpz_mpoly
20+ from flint.types.fmpz_mpoly cimport fmpz_mpoly, fmpz_mpoly_ctx, create_fmpz_mpoly
2121
2222from flint.flintlib.functions.fmpq cimport fmpq_set, fmpq_one
2323from flint.flintlib.functions.fmpq_mpoly cimport (
@@ -785,6 +785,26 @@ cdef class fmpq_mpoly(flint_mpoly):
785785 fmpq_mpoly_term_content(res.val, self .val, self .ctx.val)
786786 return res
787787
788+ def zpoly (self ):
789+ """
790+ Return the integer polynomial of ``self``. The product
791+ of this and ``self.zcontent()``, represents the whole
792+ polynomial.
793+ """
794+ cdef fmpz_mpoly_ctx zctx = fmpz_mpoly_ctx.from_context(self .ctx)
795+ cdef fmpz_mpoly res = create_fmpz_mpoly(zctx)
796+ fmpz_mpoly_set(res.val, self .val.zpoly, zctx.val)
797+ return res
798+
799+ def zcontent (self ):
800+ """
801+ Return the content of ``self``. The product of this and
802+ ``self.zpoly()``, represents the whole polynomial.
803+ """
804+ cdef fmpq res = fmpq.__new__ (fmpq)
805+ fmpq_set(res.val, self .val.content)
806+ return res
807+
788808 def resultant (self , other , var ):
789809 """
790810 Return the resultant of ``self`` and ``other`` with respect to variable ``var``.
0 commit comments