Continuous optimization
MATH-329
Vectorize your code (it's a small part of the grade for homework)
Description
Computer processors are optimized for operations called SIMD: single instructions, multiple data.
This means that when you write code, it makes a big difference if you write it in a way that your computer 'knows' that you mean to apply the same operations to many different floating point numbers: it can take advantage of that.
In turn, this means that, generally speaking, writing a for loop is /much/ slower than calling a so-called 'vectorized' routine. The process of replacing for-loops with such routines is called vectorization.
This is true for all computing languages, and it is particularly important in scripting languages such as Matlab and Python.
A small part of grading for code in homework is attributed to proper vectorization, because it makes a huge difference in practice: it's a good skill to acquire.
You can read more on this page.