On Wednesday, January 28, 2015 at 4:45:54 PM UTC-6, Simon King wrote:
>
> Hi Stefan, 
>
> On 2015-01-28, Stefan <stefan...@gmail.com <javascript:>> wrote: 
> > 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? 
>
> It looks like when you do 1/self, then 1 is coerced into self.parent(), 
> which involves the coercion system. On the other hand, coercions from ZZ 
> to self.parent() are ubiquituous, hence, it is surprising that changing 
> 1/self to self.parent().one()/self helps. 
>

No coercion is still faster than a fast coercion.
 

>
> Note that replacing 1/self by ~self may help as well. But, as you said 
> in your other posting, the default implementation of __invert__ is not 
> always perfect. 
>

The line "1/self" occurs INSIDE the __invert__ special method of 
element.pyx.

Should I open a ticket to replace that 1 by self.parent().one() ?

Also, why isn't there an _invert_ method just like _add_ and friends?

--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.

Reply via email to