Using polynomial rings in cython
Hello,
I have a sage script that is mostly made up of python code, but uses the sage implementation of polynomial rings in one variable. I have been trying to convert the script to cython to speed it up, but am getting an error because of the polynomial ring.
The first line of the script is:
t = ZZ['t'].0
which I am using to create the polynomial ring in the variable 't'. When I change the .sage extension to .spyx and try to load the file I get the error:
Syntax error in simple statement list
which points to the second "]" in the line of code.
Is there a simple way to fix this?
What do you mean by "load" the file? If I call the file
x.spyx
and do%load x.spyx
in a Sage session, it works fine.If you mean that
sage x.spyx
fails, then look at what happens when you didsage x.sage
: it created a file calledx.sage.py
. Try renaming that file asx.spyx
. Does it work better?This syntax is for babies' convenience. Use
t = polygen(QQ, "t")
instead.Thank you, that does the job.