faster rms

This commit is contained in:
Stephen McQuay 2011-05-26 14:40:02 -06:00
parent 151b61a80f
commit 9a0d0a3e10

View File

@ -10,11 +10,15 @@ def rms(errors):
"""
root mean square calculation
"""
r = 0.0
for i in errors:
r += np.power(i, 2)
r = np.sqrt(r / len(errors))
return r
# slow pure python way for reference:
# r = 0.0
# for i in errors:
# r += np.power(i, 2)
# r = np.sqrt(r / len(errors))
# return r
return np.sqrt((errors**2).mean())
def baker_exact_2D(X):
"""