Hello all,

I am developing patch # 15780.  We want to use fast_callable to increase the 
speed.

The changes we have work for most cases.  However, when we try to evaluate the 
expression tree built for a polynomial ring over a PowerSeriesRing, an 
exception is thrown.

T.<z>=PowerSeriesRing(ZZ)
P.<x,y>=PolynomialRing(T)
f=x^2+x*y
g=fast_callable(f)
g(1,1)

The cause is in generic_power_c() in sage/structure/element.pyx. Basically, the 
PowerSeriesRing element 1 fails to be recognized as the integer 1 causing the 
exception to be thrown.


try:
    from sage.rings.integer import Integer
    n = int(Integer(nn))
except TypeError:
    raise NotImplementedError, "non-integral exponents not supported"


This is occuring because the expression from fast_callable has a term ('ipow', 
n) where n is actually an integer, but whose parent is the coefficient ring of 
the polynomial ring.

The question here is basically: what part of this needs to be fixed? It seems 
odd that the exponents being returned from fast_callable are in the base ring 
causing the call to generic_power. This expression should be fast to evaluate 
and, even if it worked, this is certainly slowing it down. But it also is odd 
that Integer() is unable to coerce a power series integer.


Dillon Rose

-- 
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 [email protected].
To post to this group, send email to [email protected].
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