This lesson is being piloted (Beta version)

Performant Numpy

Numpy is a commonly-used library providing multi-dimensional arrays, and a wide range of functions to perform efficient operations across these. While it is normally orders of magnitude faster than using pure Python code, in more complex situations it’s not always obvious how to gain maximal performance.

Prerequisites

This lesson assumes that you are familiar with the Python programming language, and with some of the basics of using Numpy. If that is not the case, then you may wish to work through the Software Carpentry introduction to Python

Schedule

Setup Download files required for the lesson
00:00 1. Introduction How does Numpy give faster performance than Python?
What routes are there to get better performance out of Numpy?
00:25 2. Whole-array operations How can I avoid looping when performing operations across arrays in Numpy?
What about when there are conditionals?
What about when there are complex array multiplications?
01:25 3. Broadcasting How can I do whole-array operations with arrays of different shape?
02:15 4. Custom ufuncs What can I do if Numpy’s built-in ufuncs don’t do what I need them to?
03:00 5. Generalised ufuncs What if I want performant functions operating on Numpy arrays that aren’t element-wise?
03:55 6. Compiling regular functions with Numba What if I want to speed up non-broadcastable functions?
04:15 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.