Cimporting Sage classes with the new Sage IPython notebook

asked 2014-07-17 19:16:06 +0200

mrambaud gravatar image

updated 2015-01-13 18:21:46 +0200

FrédéricC gravatar image

Sage Version 6.2, Release Date: 2014-05-06, Unbuntu 12.04, 64 bit version


I am using the new Sage IPython notebook and would like to cimport the class "Matrix_mod2e_dense" in a cython cell.

(1) Here is a minimum working example in the Sage IPython command line (also works on a SageMathCloud terminal), and that I would like to transpose 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, and also on the SageMathCloud notebook).

(2) And here is a (nearly) minimum non working example in the Sage IPython notebook, nor on a SageMathCloud IPython notebook :

  from sage.all import *
  %load_ext sage
  %load_ext cythonmagic

    #clang C++
    from sage.all import *
    cimport numpy as np
    #It is worth noting that the *cimport numpy* works. But when I add this last 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 file ? I couldn't attach mine to this post, but could publish/send in a way or another if this might help)

Finaly, I mention similar posts, but not exactly on the same issue, so which could not help me : --- --- ---

Thank you for your help !


edit retag flag offensive close merge delete