Ask Your Question
1

Short Cython Example In A Notebook Cell?

asked 2010-08-18 23:11:58 +0100

ccanonc gravatar image

updated 2011-05-07 00:10:17 +0100

Kelvin Li gravatar image

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

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
3

answered 2010-08-19 01:39:02 +0100

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.

edit flag offensive delete link more

Comments

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 gravatar imagecswiercz ( 2010-08-19 01:43:44 +0100 )edit

Thanks very much for the notebook-oriented links. I'd issue thumbs up if not for my karma.

ccanonc gravatar imageccanonc ( 2010-08-19 01:53:01 +0100 )edit
3

answered 2010-08-19 02:16:26 +0100

Jason Grout gravatar image

updated 2010-08-19 02:18:59 +0100

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

A particularly nice example is here

edit flag offensive delete link more
2

answered 2010-08-18 23:13:47 +0100

William Stein gravatar image

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?

edit flag offensive delete link more

Comments

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 gravatar imageccanonc ( 2010-08-18 23:23:00 +0100 )edit

A short example (notebook/cell-based) on the cython.org homepage would be great.

ccanonc gravatar imageccanonc ( 2010-08-19 01:23:40 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2010-08-18 23:11:58 +0100

Seen: 1,217 times

Last updated: Aug 19 '10