Hello,

I don't know if this is the right place for this question, but all other 
discussion do focus more on mathematical issues rather than on python 
issues.

I have my own implementation of a lattice class, which is able to perform 
the closest point search on a vector. In addition it can do the modulo 
operation on a vector, which is simply:
x = vector(...)
l = Lattice(...)
mod = x % L = x - Lattice.closest_point(x)

Since the modulo operator calls the __mod__ method of the vector and there 
are many vector implementations, overwriting this method would not be the 
best approach. I got a tip, that there is a __rmod__ method, which gets 
called of the lattice when there is no implementation of __mod__ in the 
vector. This approach had limited success since the vector's __mod__ gets 
called first and it seems to call __mod__ on a single element. If the 
vector is over RDF the single element would not have a __mod__ method and 
__rmod__ of lattice gets called with just a single element, not the whole 
vector.

Is there any simple way to realize overwriting the modulo operator?

Regards,
Thomas

-- 
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org



Reply via email to