Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using matrices in Cython

I want to work with matrices in Cython. But I cannot even define a matrix. Here is the code in my Sage notebook:

sage:%%cython
sage:A=Matrix([[1,0],[0,1]])

Here is the error messsage:

RuntimeError: Error compiling Cython file:
------------------------------------------------------------
...
from sage import all
A=Matrix([[1,0],[0,1]]) ^
------------------------------------------------------------

_Users_macbook__sage_temp_bogon_52702_tmp_jzby0ki0_pyx_0.pyx:2:2: undeclared name not builtin: Matrix

In the end, my goal is to make use of this library in Cython: matrix/matrix_integer_dense.pyx

Thanks for your help