ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 18 Aug 2010 19:16:26 -0500Short Cython Example In A Notebook Cell?http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/What's the best way to integrate (new) cython code into your notebook?Wed, 18 Aug 2010 16:11:58 -0500http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/Answer by cswiercz for <p>What's the best way to integrate (new) cython code into your notebook?</p>
http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/?answer=11391#post-id-11391If you don't have any specific questions then here's an example I made of using Cython in the Sage Notebook to perform fast matrix multiplication: (Note that I'm just re-implementing the naive algorithm using various stages of Python->Cython conversion.)
<a href="http://uw.sagenb.org/home/pub/19/">http://uw.sagenb.org/home/pub/19/</a>
It's based on a talk made by one of the lead Cython developers. Also, the Cython <a href="http://docs.cython.org/">documentation</a> is excellent and most, if not all, of the language elements work naturally in the notebook environment.
Wed, 18 Aug 2010 18:39:02 -0500http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/?answer=11391#post-id-11391Comment by cswiercz for <p>If you don't have any specific questions then here's an example I made of using Cython in the Sage Notebook to perform fast matrix multiplication: (Note that I'm just re-implementing the naive algorithm using various stages of Python->Cython conversion.)</p>
<p><a href="http://uw.sagenb.org/home/pub/19/">http://uw.sagenb.org/home/pub/19/</a></p>
<p>It's based on a talk made by one of the lead Cython developers. Also, the Cython <a href="http://docs.cython.org/">documentation</a> is excellent and most, if not all, of the language elements work naturally in the notebook environment.</p>
http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/?comment=23086#post-id-23086I have another one demonstrating Sage/Pylab interfacing: <a href="http://uw.sagenb.org/home/pub/20/">http://uw.sagenb.org/home/pub/20/</a>. This one is also based on a Cython talk.Wed, 18 Aug 2010 18:43:44 -0500http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/?comment=23086#post-id-23086Comment by ccanonc for <p>If you don't have any specific questions then here's an example I made of using Cython in the Sage Notebook to perform fast matrix multiplication: (Note that I'm just re-implementing the naive algorithm using various stages of Python->Cython conversion.)</p>
<p><a href="http://uw.sagenb.org/home/pub/19/">http://uw.sagenb.org/home/pub/19/</a></p>
<p>It's based on a talk made by one of the lead Cython developers. Also, the Cython <a href="http://docs.cython.org/">documentation</a> is excellent and most, if not all, of the language elements work naturally in the notebook environment.</p>
http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/?comment=23084#post-id-23084Thanks very much for the notebook-oriented links. I'd issue thumbs up if not for my karma.Wed, 18 Aug 2010 18:53:01 -0500http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/?comment=23084#post-id-23084Answer by Jason Grout for <p>What's the best way to integrate (new) cython code into your notebook?</p>
http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/?answer=11375#post-id-11375There are lots of examples if you search sagenb.org for "%cython": [Here is the search][1]
A particularly nice example is [here](http://sagenb.org/home/pub/2046/)
[1]: http://sagenb.org/pub/?typ=pub&search=%25cythonWed, 18 Aug 2010 19:16:26 -0500http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/?answer=11375#post-id-11375Answer by William Stein for <p>What's the best way to integrate (new) cython code into your notebook?</p>
http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/?answer=11388#post-id-11388This question is extremely open ended and not very specific, so I'm not sure how to answer.
One point, is that you use %cython to create a notebook cell that is evaluated using Cython.
Do you have a more specific question about using Cython with the Sage notebook?Wed, 18 Aug 2010 16:13:47 -0500http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/?answer=11388#post-id-11388Comment by ccanonc for <p>This question is extremely open ended and not very specific, so I'm not sure how to answer.</p>
<p>One point, is that you use %cython to create a notebook cell that is evaluated using Cython.</p>
<p>Do you have a more specific question about using Cython with the Sage notebook?</p>
http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/?comment=23092#post-id-23092Thanks, I hadn't seen the %cython directive before. I didn't see cython in the language pull-down, and the docs I've found so far are command-line oriented. I was hoping for a small notebook example. I googled it, but didn't see what I was looking for.Wed, 18 Aug 2010 16:23:00 -0500http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/?comment=23092#post-id-23092Comment by ccanonc for <p>This question is extremely open ended and not very specific, so I'm not sure how to answer.</p>
<p>One point, is that you use %cython to create a notebook cell that is evaluated using Cython.</p>
<p>Do you have a more specific question about using Cython with the Sage notebook?</p>
http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/?comment=23087#post-id-23087A short example (notebook/cell-based) on the cython.org homepage would be great.Wed, 18 Aug 2010 18:23:40 -0500http://ask.sagemath.org/question/7559/short-cython-example-in-a-notebook-cell/?comment=23087#post-id-23087