3 ms·
Another thing to add, the python example code is a written in quite a weird (and in my opinion difficult to read way). n = len(a) M = np.exp(1jk(np.tile(a,(n,1
by cycomanic 5y ago
Another thing to add, the python example code is a written in quite a weird (and in my opinion difficult to read way).
n = len(a)
M = np.exp(1jk(np.tile(a,(n,1))*2 + np.tile(a.reshape(n,1),(1,n))*2))
is equivalent to
M = np.exp(1jk(a[:,None]*2 + a[None,:]*2))
which I find very easy to grasp.
- alanbernstein 5y agoA big improvement, but i'm not sure if indexing with None is very intuitive.
- occamrazor 5y agonp.newaxis instead of None is the idiomatic way