-
-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix factory keys for finite fields to avoid repeated construction #16934
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:9
I don't claim to know what is going on, but it may be caused by equality and identity not being the same for finite fields; #16855 seems to fix this bug. |
comment:10
This guess is corroborated by the fact that the following change also appears to fix the bug: --- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx
+++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx
@@ -202,7 +202,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement):
cdef Integer xi
if isinstance(x, FiniteFieldElement_pari_ffelt):
- if self._parent is (<FiniteFieldElement_pari_ffelt>x)._parent:
+ if self._parent == (<FiniteFieldElement_pari_ffelt>x)._parent:
pari_catch_sig_on()
self.construct((<FiniteFieldElement_pari_ffelt>x).val)
else: After #16855, this change effectively does nothing. |
comment:11
Replying to @pjbruin:
Would you propose to make the above change, or simply to close as ticket as dupe of #16855? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:14
Replying to @jdemeyer:
I would say either we close this as a duplicate of #16855, or we try to fix the other bug (#16855 comment:11) here:
|
comment:15
OK, let's wait and see what happens with #16855 then... |
comment:16
The construction of the non-identical |
Dependencies: #16930 |
Commit: |
This comment has been minimized.
This comment has been minimized.
Author: Peter Bruin |
comment:19
Diff for easier reviewing: sagemath/sagetrac-mirror@8cdbd79...ffb74fa |
Changed branch from u/pbruin/16934-FiniteField_factory_key to u/jdemeyer/ticket/16934 |
comment:21
Please restore the warning
for all prime finite field implementations because the modulus really is ignored:
Of course we could change that behaviour (perhaps we should), but let's do that on a new ticket. New commits:
|
Changed branch from u/jdemeyer/ticket/16934 to u/pbruin/16934-FiniteField_factory_key |
comment:22
This commit adds back the warning. Alternatively, it could have been put outside the |
comment:23
|
comment:24
Replying to @pjbruin:
I would prefer to have the warning in one place. If we ever allow a custom modulus, we should allow it for all implementations. My vision for this "modulus" argument is that the following should assign to
so perhaps we should expand the warning to say
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Reviewer: Jeroen Demeyer |
comment:28
Replying to @jdemeyer:
The word "modulus" here is definitely wrong. If anything is a modulus for In general, even for field extensions, the word modulus is confusing. That only applies if you're making the field as a quotient of a polynomial ring. For the purpose proposed, |
comment:29
Replying to @nbruin:
Depends on how you look at it. For me, there is a big philosophical difference between For fields |
Changed branch from u/pbruin/16934-FiniteField_factory_key to |
The following sequence of commands somehow breaks the coercion framework. This is on vanilla Sage 6.4.beta1. The problem only occurs if
impl="pari_ffelt"
is explicitly given, even though that is the default:The underlying reason is:
This double construction of the same finite field is caused by slightly different
UniqueFactory
keys arising during the construction of a common parent (for the computation ofa/2
) by the coercion system.Related: #16855
Depends on #16930
Component: finite rings
Author: Peter Bruin
Branch/Commit:
9cbdcde
Reviewer: Jeroen Demeyer
Issue created by migration from https://trac.sagemath.org/ticket/16934
The text was updated successfully, but these errors were encountered: