> The question, now, is why the coercion system is invoked at all: I'm doing > arithmetic within my own ring. The culprit, I guess, is the expression > 1/self in element.pyx. > > Does a ring keep track of its own multiplicative identity element? >
A: yes, it does. If I replace, in element.pyx line 1927, return 1/self by return self._parent.one_element() / self then my code runs in half the time. How do I check if this impacts other parts of Sage? Unrelated: the __invert__ method of the MultiplicativeGroupElement class (again in element.pyx) calls "self.is_one()" but the class does not implement that method. Example (obtained from digging in the source code): sage: s = EtaGroupElement(EtaGroup(8), {1:24, 2:-24}) sage: s^(-1) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) ... AttributeError: 'EtaGroupElement' object has no attribute 'is_one' Cheers, Stefan. -- 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.