Make comparisons is_one, and is_zero consistent for polys #168
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
nmod_poly previously compared unequal to an integer e.g.
This was inconsistent with all other poly types and also with nmod. The change here makes it so that
nmod_poly
can compare equal with anything that can be coerced by the nmod constructor.We currently have:
So an exception is made here for int but comparison with fmpz is not allowed. The change here does the same thing for nmod_poly. It will compare unequal to fmpz_poly but will compare equal to an int or an nmod with the same modulus.
Also renamed all
__nonzero__
methods to__bool__
(Python 3 vs 2)Also added
is_one
andis_zero
to almost all*_poly
and*_mpoly
types because this was inconsistent before.The two poly types that I didn't add
is_one
andis_zero
to arearb_poly
andacb_poly
. I was unsure what the expected behaviour there should be...Currently
fmpz_mod
has bothis_one
andis_zero
but all other scalar types do not. I'm not sure whether it makes sense to add them just for overall consistency. No matrix types haveis_zero
oris_one
although there are corresponding Flint functions for this.