#4836: pari types getattr() function ugly and inefficient
------------------------------+---------------------------------------------
Reporter: cremona | Owner: was
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.6
Component: interfaces | Keywords: pari gp getattr
Author: Jeroen Demeyer | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
------------------------------+---------------------------------------------
Description changed by jdemeyer:
Old description:
> the pari interface relies on the function getattr(), e.g. as in
> {{{
> zk_basis = K.pari_nf().getattr('zk')
> }}}
> but I *really* don't like this function! Each of these dot-attributes
> in pari is a short-cut, in this case to {{{K.pari_nf()[6]}}}, as these
> are
> easier when running gp than remembering which field is which in the
> nf/bnf structures. There are not very many of these (I started making
> a list). But what I do not like is the implementation of getattr() in
> Sage:
> {{{
> def getattr(self, attr):
> t0GEN(str(self) + '.' + str(attr))
> _sig_on
> return self.new_gen(t0)
> }}}
> So it converts the nf into a string (in my examples, that's a string
> of length 59604), adds ".zk" to it, and reparses the input (using the gp
> parser).
>
> More generally: using PARI through the string interface (i.e.
> {{{pari("some string")}}}) should be avoided when it might give a large
> overhead.
>
> Dependencies: #9898
New description:
the pari interface relies on the function getattr(), e.g. as in
{{{
zk_basis = K.pari_nf().getattr('zk')
}}}
but I *really* don't like this function! Each of these dot-attributes
in pari is a short-cut, in this case to {{{K.pari_nf()[6]}}}, as these are
easier when running gp than remembering which field is which in the
nf/bnf structures. There are not very many of these (I started making
a list). But what I do not like is the implementation of getattr() in
Sage:
{{{
def getattr(self, attr):
t0GEN(str(self) + '.' + str(attr))
_sig_on
return self.new_gen(t0)
}}}
So it converts the nf into a string (in my examples, that's a string
of length 59604), adds ".zk" to it, and reparses the input (using the gp
parser).
More generally: using PARI through the string interface (i.e.
{{{pari("some string")}}}) should be avoided when it might give a large
overhead.
Dependencies: #9898, #9753
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4836#comment:10>
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.