#10007: Enable deriving subclasses of FreeModule and FreeModuleElement
------------------------+---------------------------------------------------
   Reporter:  nborie    |       Owner:  AlexGhitza
       Type:  task      |      Status:  new       
   Priority:  critical  |   Milestone:            
  Component:  algebra   |    Keywords:            
     Author:            |    Upstream:  N/A       
   Reviewer:            |      Merged:            
Work_issues:            |  
------------------------+---------------------------------------------------
Description changed by nthiery:

Old description:

> When building a new class (strong algebraic structure of parent) which
> have a structure of module, one "can" only use CombinatorialFreeModule.
> It will be very very good to do that with FreeModule (speed, use all
> functionalities of FreeModule).
>
> Any operation on elements make it go out of the element class (but the
> parent stay the right one.)
>
> See that :
> {{{
> sage: class Bla_parent(sage.modules.free_module.FreeModule_generic):
> ....:         class
> Element(sage.modules.free_module_element.FreeModuleElement_generic_dense):
> ....:             pass
> ....:
> sage: F = Bla_parent(QQ,6,6)
> sage: F
> <class '__main__.Bla_parent_with_category'>
> sage: p = F.Element(F,(1,2,3,4,5,6))
> sage: p
> (1, 2, 3, 4, 5, 6)
> sage: p.__class__
> <class '__main__.Element'>
> sage: (p+p).__class__
> <type 'sage.modules.free_module_element.FreeModuleElement_generic_dense'>
> }}}

New description:

 When building a new parent P which has a structure of module, one can
 currently can derive from CombinatorialFreeModule. It would be very
 very good, when mathematically appropriate to be able to derive
 instead from FreeModule, in order to benefit from its efficiency and
 many functionalities.

 This is currently not possible, because arithmetic creates new
 elements whose class is FreeModuleElement_* instead of the derived
 class for the elements of P (the parent remains P as desired):

 {{{
 sage: class Bla_parent(sage.modules.free_module.FreeModule_generic):
 ....:         class
 Element(sage.modules.free_module_element.FreeModuleElement_generic_dense):
 ....:             pass
 ....:
 sage: F = Bla_parent(QQ,6,6)
 sage: F
 <class '__main__.Bla_parent_with_category'>
 sage: p = F.Element(F,(1,2,3,4,5,6))
 sage: p
 (1, 2, 3, 4, 5, 6)
 sage: p.__class__
 <class '__main__.Element'>
 sage: (p+p).__class__
 <type 'sage.modules.free_module_element.FreeModuleElement_generic_dense'>
 }}}

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10007#comment:2>
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.

Reply via email to