Silly Cython question

26 views
Skip to first unread message

Watson Ladd

unread,
Feb 21, 2017, 4:02:54 PM2/21/17
to sage-support
Dear all,

I want to convert code that uses calls like M=Matrix(QQ, n, n) and v=vector(QQ, n) to Cython. When I do so I get errors about undeclared names. I am having trouble figuring out which imports I need to get the right names to appear: there is sufficient magic that most of the obvious guesses produce runtime errors. The code of course works fine in regular Sage. Where should I be looking to figure out how to fix these problems?

Sincerely,
Watson ladd

Jeroen Demeyer

unread,
Feb 21, 2017, 4:07:43 PM2/21/17
to sage-s...@googlegroups.com
On 2017-02-21 22:02, Watson Ladd wrote:
> I am having trouble figuring out which imports I need to get the
> right names to appear

Use the import_statements() function to determine which import
statements you need. There shouldn't be a difference between Python and
Cython regarding import statements.

Watson Ladd

unread,
Feb 21, 2017, 5:02:25 PM2/21/17
to sage-support
Thank you! That solved the problem. 

John Cremona

unread,
Feb 22, 2017, 3:38:13 AM2/22/17
to SAGE support
After newarly 10 years of work on Sage I did not know of
import_statements()! Just yesterday I was doing things like
search_src("import", "primes") when I could have just done
import_staements(primes).

Thanks, Jeroen.



>
>
> Thank you! That solved the problem.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages