On Monday 30 October 2006 22:38, David Harvey wrote:
> I want to start applying our arithmetic architecture to _mul_. The fast
> pathway for __mul__ needs to be able to quickly identify the case of
> multiplying an element of a base ring of an algebra by an element of
> the algebra (or commutative algebra as the case may be). The sanest way
> to do this really fast is for base_ring to be a cdef attribute of
> Algebra and CommutativeAlgebra.
>
> Unfortunately this is going to run us into multiple inheritance
> problems with matrices (and possibly other things). Currently in
> William's development code, the MatrixSpace_generic class inherits from
> Generators. This has a bunch of cdef'd attributes. So it won't be
> possible to simultaneously inherit from Algebra too, if Algebra has a
> cdef'd base_ring.

I've got an evil idea: What if Generators had a base_ring cdef'd? I know that 
this makes no sense for general Generators but it would only be one single 
pointer which isn't even visible to Python (i.e. not confusing the higher 
levels). A big fat warning in a comment where it is defined would clarify 
everything for library developers. It's a hack and probably to reject but I 
guess it should be on the table before being rejected.

> I suppose another possibility is for the *elements* of an algebra to
> carry around a cdef pointer to the base ring, much like they already
> carry around a pointer to the parent. That will be ever-so-slightly
> faster, but it will increase the memory consumption of every element.
> This is probably not a big deal, as most algebra elements will already
> take up a lot of space anyway, and it's just one extra pointer. The
> algebras themselves can also keep a base_ring, but as a python
> attribute, and they won't have as fast access to it.

> On the other hand.... maybe this test doesn't need to be so fast after
> all. We can still test first for matching RingElement parents very
> quickly. If it's true that algebra elements are generally quite
> complicated objects, then probably a python attribute lookup is not
> such a big deal. Maybe I'm over-optimising.

About the quite complicated objects: I guess the simplest/smallest algebra 
element I can think of is a dense matrix over GF(2), i.e. a bitstring. That's 
something SAGE should have in a very fast way.

Martin

-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_icq: 177334829
_jab: [EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to