Short Cython Example In A Notebook Cell?

i like this post (click again to cancel)
1
i dont like this post (click again to cancel)

What's the best way to integrate (new) cython code into your notebook?

asked Aug 18 '10

ccanonc gravatar image ccanonc
477 3 15 32

updated May 06 '11

Kelvin Li gravatar image Kelvin Li
423 9 16

3 Answers:

i like this answer (click again to cancel)
3
i dont like this answer (click again to cancel) ccanonc has selected this answer as correct

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.)

http://uw.sagenb.org/home/pub/19/

It's based on a talk made by one of the lead Cython developers. Also, the Cython documentation is excellent and most, if not all, of the language elements work naturally in the notebook environment.

link

posted Aug 18 '10

cswiercz gravatar image cswiercz
809 5 15 33
http://www.cswiercz.info/
I have another one demonstrating Sage/Pylab interfacing: http://uw.sagenb.org/home/pub/20/. This one is also based on a Cython talk. cswiercz (Aug 18 '10)
Thanks very much for the notebook-oriented links. I'd issue thumbs up if not for my karma. ccanonc (Aug 18 '10)
i like this answer (click again to cancel)
3
i dont like this answer (click again to cancel)

There are lots of examples if you search sagenb.org for "%cython": Here is the search

A particularly nice example is here

link

posted Aug 19 '10

Jason Grout gravatar image Jason Grout
3185 7 27 71

updated Aug 19 '10

i like this answer (click again to cancel)
2
i dont like this answer (click again to cancel)

This 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?

link

posted Aug 18 '10

William Stein gravatar image William Stein
1195 5 17 40
http://wstein.org/
Thanks, 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. ccanonc (Aug 18 '10)
A short example (notebook/cell-based) on the cython.org homepage would be great. ccanonc (Aug 18 '10)

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]

Question tools

3 followers

Tags:

Stats:

Asked: Aug 18 '10

Seen: 420 times

Last updated: Aug 19 '10

powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.