| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Sorry for the force-push, I've added docstring tests to both functions. |
Sorry, something went wrong.
| 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.
Sorry, something went wrong.
| - 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?
Sorry, something went wrong.
There was a problem hiding this comment.
Actually the PR number should be 421...
Sorry, something went wrong.
|
Maybe it would be better to add content and primitive methods like with fmpz_mpoly. The difference would just be the sign when the zcontent is negative since content for fmpz_poly/fmpz_mpoly is nonnegative gcd. That would sometimes require negating the zpoly but presumably that is not much more expensive than making a copy anyway. Compare to fmpz_mpoly the difference would also be that the primitive part is of a different type (fmpq_mpoly -> fmpz_mpoly) but maybe that is just to be expected here... |
Sorry, something went wrong.
|
What about content and zprimitive then? :) |
Sorry, something went wrong.
|
This version of content is not equivalent because of the sign: 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 primitive and content with them being consistent with the same methods for fmpz_mpoly. Then primitive should actually return (fmpq, fmpq_mpoly) to stay in the ring. So maybe it still makes sense to have separate methods for this kind of content that just gets the internal representation. Maybe zcontent and zpoly are fine. At least the names show that they go together. |
Sorry, something went wrong.
Also fix their docstring tests.
|
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. |
Sorry, something went wrong.
|
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 zcontent and zprimitive are fine as long as the names are clearly distinct from .content() and .primitive() as used elsewhere. |
Sorry, something went wrong.
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. |
Sorry, something went wrong.
|
Okay, looks good. Thanks |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This fixes issue #419.