Sage Version 6.2, Release Date: 2014-05-06
Unbuntu 12.04, 64 bit version
Hello,
I am using the new Sage IPython notebook and would like to cimport the C class "Matrix_mod2e_dense" in a cython cell.
1) Here are the instructions that work in the Sage IPython command line, and that I would like to make work in the Ipython notebook :
from sage.all import *
cython("#clang C++\n from
sage.matrix.matrix_mod2_dense cimport Matrix_mod2_dense")
(A similar statement works in the old Sage notebook).
2) And here are the instructions that fail in the Sage IPython notebook :
from sage.all import *
%load_ext sage
%load_ext cythonmagic
%%cython
#clib m4ri
#from sage.libs.m4ri cimport *
#clang C++
from sage.all import *
cimport numpy as np
#(So far everything is accepted, including the cimport numpy. But when I add this statement : )
from sage.matrix.matrix_mod2e_dense cimport Matrix_mod2e_dense
It then says : .cache/ipython/cython/_cython_magic_9842ede087c20823a43baddf277ba52c.pyx:6:0: 'Matrix_mod2e_dense.pxd' not found
3) So everything leads me to think that it is the cimport command that is badly interpreted by the Ipython Notebook.
Does someone has a solution to make (1) work in the Sage Ipython Notebook ? (For instance, what should I add/remove in the cythonmagic.py file ? Just in case, I attached mine to this post.)
Finaly, I mention similar posts on AskSage.org , but not exactly on the same issue, so which could not help me :
http://ask.sagemath.org/question/2575/importing-sage-functions-into-cython http://ask.sagemath.org/question/2766/about-cython-and-the-main-sage-commandsThank you for your help !
Matthieu