[SciPy-User] [SciPy-user] Avoiding inner for loops??
Tue Aug 21 19:14:59 CDT 2012
> You may like to utilize functionality of ix_ and newaxis, like:
In : p1, p2, p3= ix_(param1, param2, param3)
In : n_= newaxis
In : ans= fake_model(data1[:, n_, n_, n_], data2[:, n_, n_, n_], p1, p2,
In : ss2= ((obs[:, n_, n_, n_]- ans).sum(0)** 2).reshape(grid_size** 3)
In : allclose(ss, ss2)
My 2 cents,
This solution is exactly what I was looking for thank you. I hadn't come
across np.ix_ before.
View this message in context: http://old.nabble.com/Avoiding-inner-for-loops---tp34319763p34332203.html
Sent from the Scipy-User mailing list archive at Nabble.com.
More information about the SciPy-User