January 2020
Intermediate to advanced
532 pages
13h 31m
English
In a data processing pipeline, we may encounter a situation where the functions can be fused together into a single loop. This is called broadcasting and it can be conveniently enabled by using the dot notation. Using broadcasting may make a huge performance difference for data-intensive applications.
Consider the following scenario, where two vectorized functions have already been defined, as follows:
add1v(xs) = [x + 1 for x in xs]mul2v(xs) = [2x for x in xs]
The add1v function takes a vector and increments all the elements by 1. Likewise, the mul2v function takes a vector and multiplies every element by 2. Now, we can combine the functions to create a new one that takes a vector and sends it down the ...
Read now
Unlock full access