|Authors||I. Wilbers, H. P. Langtangen and Å. Ødegård|
|Editors||B. H. Skallerud and H. I. Andersson|
|Title||Using Cython to Speed Up Numerical Python Programs|
|Project(s)||Center for Biomedical Computing (SFF)|
|Publication Type||Proceedings, refereed|
|Year of Publication||2009|
|Conference Name||MekIT´09. Fifth national conference on Computational Mechanics|
The present study addresses a series of techniques for speeding up numerical calculations in Python programs. The techniques are evaluated in a benchmark problem involving finite difference solution of a wave equation. Our aim is to find the optimal mix of user-friendly, high-level, and safe programming in Python with more detailed and more error-prone low-level programming in compiled languages. In particular, we present and evaluate Cython, which is a new software tool that combines high- and low-level programming in an attractive way with promising performance. Cython is compared to more well-known tools such as F2PY, Weave, and Instant. With the mentioned tools, Python has a significant potential as programming platform in computational mechanics.