Introduction
In this lesson, we'll learn how to maximize the speed using NumPy!
This chapter explains the basic anatomy of NumPy arrays, especially regarding the memory layout, view, copy and the data type. They are critical notions to understand if you want your computation to benefit from NumPy philosophy.
Let’s consider a simple example where we want to clear all the values from an
array which has the data type np.float32
. How does one write it to maximize speed? The
below syntax is rather obvious (at least for those familiar with NumPy) but the
above question asks to find the fastest operation.