Dear Mike, dear Robert B.,

> Mike:
> Maybe I'm just confused, but I'm not sure how the element hierarchy in
> your categories works with Cython.  In particular, what do you see the
> inheritance tree looking like for say ModuleElement since you want
> that to be in Cython so that arithmetic with them can be fast.

Here is what I have in mind; it's good that we discuss this to check
this is indeed feasible.

Most of free modules won't use ModuleElement straight away, but rather
some subclass (with extra operations). Then, for the inheritance tree,
I see two options (the only difference is whether or not ModuleElement
"inherits" from ModuleWithBasis.element_class):

(I)
         ...               ...        ...                ...
          |                 |         /                   |
         ...         ModuleWithBasis.element_class  Algebra.element_class
          |                 |                      /
    ModuleElement   AlgebraWithBasis.element_class
          |          /
    MyAlgebraElement


(II)
         ...               ...        ...                ...
          |                 |         /                   |
         ...         ModuleWithBasis.element_class  Algebra.element_class
          |       /         |                      /
    ModuleElement   AlgebraWithBasis.element_class
          |          /
    MyAlgebraElement


With (I), ModuleElement barely defines a data structure + a repository
of some fast operations, but without mathematical structure; it cannot
really be used by itself. Some of the standard ModuleWithBasis
operations may very well be only defined generically in
ModuleWithBasis.element_class without fast cython specialization in
ModuleElement.


With (II), ModuleElement is really a ModuleWithBasis. This is
mathematically nicer, and, in the simple cases, allows for using
ModuleElement directly without deriving a subclass. But this requires
some partial multiple inheritance support for Cython classes of the
form: in m.a, if a is an attribute of m or is defined by a super class
in the linear hierarchy above ModuleElement, then do the usual
thing. Otherwise, resort to a "library level" getattribute lookup
through the full hierarchy. I don't know how feasible this is.

Best,
                                Nicolas
--
Nicolas M. ThiƩry "Isil" <[EMAIL PROTECTED]>
http://Nicolas.Thiery.name/

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to