On Wed, Feb 11, 2015 at 9:17 AM, Marc Mezzarobba <m...@mezzarobba.net> wrote:
> Jeroen Demeyer wrote:
>
>> You are missing something:
>
> Indeed! Thanks for pointing it out. That was sloppy grepping of mine.
>
>> * finite fields are Python
>> (src/sage/rings/finite_rings/finite_field_*.py)
>
> So in this case, apparently,
>
>  (i) the Python parent classes derive from an abstract Cython class
>      (in addition to Parent, Ring, etc.);
>
> (ii) beside their pointers to the parents, some elements store pointers
>      to a separate Cyton data structure that contains the information
>      that arithmetic operations need to access (same idea as the
>      "shadow parent" of my first message).
>
> Would that be the/a recommended way to get fast arithmetic on small
> objects?

Yes, this is perfectly fine. Actually implementing the Parent in
Cython works too, but then one runs into the issue of circular imports
at the C level...

> Sorry if my questions are not clearly motivated by a concrete example.
> I am trying to get an idea of what is current best practice and what is
> there for historical reasons among what I see in the sage library.

And these are very good questions.

> If
> this helps, an example to which I think some of this applies is the
> beginning implementation of a RealBallField based on arb (#17194), which
> I am trying to review. But that's not the only or even the primary
> motivation of my questions.
>
> Thanks again,
>
> --
> Marc
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to