Making Computation Easier with Cool Numpy Tricks
summary
Demo shows concrete speedups and working code: creating a 100,000-element array takes ~1.04 ms vs ~5.2 ms in plain Python, summing takes ~462 µs vs ~19 ms, and averaging 443 µs vs 45 ms; it claims about an order of magnitude improvement. It uses broadcasting for elementwise ops, uses stride_tricks to create sliding windows as zero-copy views, and uses einsum to do fast reductions and a convolution built from stride views plus einsum that produces the expected 3×3 output (repo: https://github.com/kirit93/NumpyTutorial).
AI-written summary · about
chapters (8)
- 0:00Introduction
- 2:26Basic Numpy
- 9:38Structured Numpy Array
- 11:43Broadcasting
- 19:03Fancy Indexing numpy
- 1:04:06Stride Tricks
- 1:12:30Einsum
- 1:23:47Convolution using stride tricks and einsum
related talks
01h 27mMaking computation easier with cool Numpy tricks
34mNumPy: vectorize your brain
35mVectorization: How slow Python runs fast code
27mAPL-Inspired Techniques for Advanced NumPy
37mUsing Numba Effectively Today
38mVectorize all the things! Using linear algebra and NumPy to make your Python code lightning fast
22mSupercharge Scientific Computing in Python with Numba
37mAccelerating Scientific Computing in Python with Numba: A Real-World Example
