Add fmpq_mpoly.zpoly and fmpq_mpoly.zcontent (fixes #419) - #421
Conversation
13d99ae to
43dc15d
Compare
|
Sorry for the force-push, I've added docstring tests to both functions. |
| def term_content(self) -> fmpq_mpoly: ... | ||
|
|
||
| def zpoly(self) -> fmpz_mpoly: ... | ||
| def zcontent(self) -> fmpq: ... |
There was a problem hiding this comment.
I guess zcontent isn't a good name for this if it is fmpq.
| - Insert Name (IN) | ||
|
|
||
| Changes (0.10.0): | ||
|
|
||
| - [gh-322](https://github.com/flintlib/python-flint/pull/322), Add `zcontent` | ||
| and `zpoly` methods to `fmpq_mpoly`, to get the primitive integer polynomial | ||
| of self and the `fmpq` content (the internal representation of the | ||
| `fmpq_mpoly`). (IN) |
There was a problem hiding this comment.
Can you add your name and initial to the release note section I just added?
There was a problem hiding this comment.
Actually the PR number should be 421...
|
Maybe it would be better to add Compare to |
|
What about content and zprimitive then? :) |
|
This version of In [13]: from flint import *
In [14]: Rz = fmpz_mpoly_ctx.get(['x', 'y'])
In [15]: Rq = fmpq_mpoly_ctx.get(['x', 'y'])
In [16]: xz, yz = Rz.gens()
In [17]: xq, yq = Rq.gens()
In [18]: (-xz).content()
Out[18]: 1
In [19]: (-xq).content()
Out[19]: -1I think it would be good to have So maybe it still makes sense to have separate methods for this kind of content that just gets the internal representation. Maybe |
40862be to
7964fe4
Compare
Also fix their docstring tests.
7964fe4 to
1f3c4a5
Compare
|
I've renamed it. The naming inconsistency really comes from the underlying FLINT API. As long as python-flint stays a relatively thin wrapper, it will show up one way or another. |
|
FLINT has these two functions: fmpq_mpoly_content_ref
fmpq_mpoly_contentThe first is for accessing the struct member and the second is for computing the mathematical content. They can differ by a minus sign. I agree that is a confusing naming convention but that's why it is important to consider names of things in the first place. I think that |
The CI job would sporadically fail because FLINT 3.1 has a bug that makes it fail to build on newer GitHub Actions runners (with e.g. znver3 as the CPU name).
|
I've renamed it from zprimitive back to zpoly. I think that zpoly matches the struct method name so someone familiar with the FLINT struct can find it. Maybe zcontent is misleading but the two method names match so it is clear that they go together. I think that's the best we can do here. |
|
Okay, looks good. Thanks |
This fixes issue #419.