2008/8/12 Nadav Horesh <[EMAIL PROTECTED]>: > from numpy import * > > a = sqrt(maximum(0, a**2-repeat(b*c, columns).reshape(columns, rows)))
better: import numpy as np a = np.sqrt(np.maximum(0.0, a**2-(b*c)[np.newaxis,:])) This doesn't have to make a temporary the size of a; instead broadcasting rules are used to treat b*c as if it were the same shape as a. Also, "from numpy import *" is a good way to shoot yourself in the foot. At least "from numpy import sqrt, maximum, repeat" would have been safer. Anne _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
