by aborsy · 1y ago · 0 comments
In my view, python+numpy is not actually an array language. Numpy as a library adds vectorization operations to python in order to help with speed. This is different. It does not (intend to) bring the advantages that array language syntax has, even if it was a bit more consistent.
A = [1, 2; 3, 4];
x = [5; 6];
y = A * x;
with this uglier version:
import numpy as np
A = np.array([[1, 2], [3, 4]])
x = np.array([[5], [6]])
y = A @ x
from numpy import *
A = [[1, 2], [3, 4]]
x = [[5], [6]]
y = dot(A, x) [[1, 2], [3, 4], [5], [6]]
instead of array([[ 6, 7],[ 9, 10]])
You have to keep track of the context there to know what you can do and what not I guess, which is not ideal.