#11530: Conversion of finite field elements to PARI mangles Mod
------------------------------+---------------------------------------------
Reporter: rbeezer | Owner: AlexGhitza
Type: defect | Status: needs_review
Priority: major | Milestone: sage-4.7.1
Component: algebra | Keywords: _pari_init_, variable name,
finite field
Work_issues: | Upstream: N/A
Reviewer: Jeroen Demeyer | Author: Simon King, Rob Beezer
Merged: | Dependencies:
------------------------------+---------------------------------------------
Changes (by rbeezer):
* status: needs_work => needs_review
Old description:
> {{{
> sage: F.<d> = GF(3^2)
> sage: d._pari_()
> Mod(d, Mod(1, 3)*d^2 + Mod(2, 3)*d + Mod(2, 3))
> sage: d._pari_init_("m")
> 'Mom(m, Mom(1, 3)*m^2 + Mom(2, 3)*m + Mom(2, 3))'
> sage: d._pari_init_("p")
> 'Mop(p, Mop(1, 3)*p^2 + Mop(2, 3)*p + Mop(2, 3))'
> sage: d._pari_init_("b")
> 'Mob(b, Mob(1, 3)*b^2 + Mob(2, 3)*b + Mob(2, 3))'
> }}}
>
> More care needs to be taken with a search and replace, maybe it should
> come earlier in
> {{{sage.rings.finite_rings.element_givaro.FiniteField_givaroElement._pari_init_}}}.
>
> '''Apply:'''
> 1. [attachment:11530_pari_init-v3.patch]
New description:
{{{
sage: F.<d> = GF(3^2)
sage: d._pari_()
Mod(d, Mod(1, 3)*d^2 + Mod(2, 3)*d + Mod(2, 3))
sage: d._pari_init_("m")
'Mom(m, Mom(1, 3)*m^2 + Mom(2, 3)*m + Mom(2, 3))'
sage: d._pari_init_("p")
'Mop(p, Mop(1, 3)*p^2 + Mop(2, 3)*p + Mop(2, 3))'
sage: d._pari_init_("b")
'Mob(b, Mob(1, 3)*b^2 + Mob(2, 3)*b + Mob(2, 3))'
}}}
More care needs to be taken with a search and replace, maybe it should
come earlier in
{{{sage.rings.finite_rings.element_givaro.FiniteField_givaroElement._pari_init_}}}.
'''Apply:'''
1. [attachment:11530_pari_init-v4.patch]
--
Comment:
Good idea, Jeroen. {{{self.polynomial()._pari_with_name(var)}}} hits the
coefficients of an element with a {{{Mod}}}, so the behavior changes.
Perhaps not a problem, but also perhaps not worth the risk either. Makes
a couple of other doctests fail, but maybe just for {{{_pari_}}} for
finite field elements.
Therefore the v4 patch basically just strips the {{{str()}}} and
{{{repr()}}} and lets the {{{format()}}} take care of string formatting.
Passes all tests in sage/rings.
I will run long tests in the next 12 hours when my machine is free, but I
think it is safe to review now, and I'll post about long tests either way.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11530#comment:15>
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.