NumPy Array math
The power of NumPy and SciPy come (not only from the performance) but the functionality.
NumPy arrays have all the basic math operator functionality you expect - so you can add, subtract, multiply and divide arrays.
Note that unlike MATLAB, *
is elementwise multiplication, not matrix multiplication. We instead use the dot
function to compute inner products of vectors, to multiply a vector by a matrix, and to multiply matrices. dot
is available both as a function in the NumPy module and as an instance method of array objects.
References