#11946: Finite fields: add "primitive_element" as alias for
"multiplicative_generator"
------------------------------+---------------------------------------------
Reporter: jdemeyer | Owner: was
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-4.7.3
Component: user interface | Keywords: GF
Work_issues: | Upstream: N/A
Reviewer: | Author: Jeroen Demeyer
Merged: | Dependencies:
------------------------------+---------------------------------------------
Comment(by kini):
Silly question, but why not just do this?
{{{
#!diff
diff --git a/sage/rings/finite_rings/finite_field_base.pyx
b/sage/rings/finite_rings/finite_field_base.pyx
--- a/sage/rings/finite_rings/finite_field_base.pyx
+++ b/sage/rings/finite_rings/finite_field_base.pyx
@@ -87,6 +87,7 @@
"""
from sage.categories.finite_fields import FiniteFields
Field.__init__(self, base, names, normalize,
category=FiniteFields())
+ self.primitive_element = self.multiplicative_generator
def __repr__(self):
"""
}}}
The docstring you wrote is basically the same as the docstring for
`multiplicative_generator`, so eliminating it will avoid double-
maintenance pitfalls. And this way you don't get one more call frame on
the stack when using the function. ... right?
And something else a bit bizarre is happening. With the diff I pasted
above, the second test produces the output `a`, which matches the last
doctest in the docstring of the `multiplicative_generator` method. But
your patch gives `a + 5`, even though it's just calling
`multiplicative_generator`, and also produces a large number of messages
in `stderr` (which are therefore not noticed by `sage -t`); they all read
as follows:
{{{
*** Warning: Mod(a,b)^n with n >> b : wasteful.
}}}
What's going on?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11946#comment:3>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.