Can anyone direct me to the section of numpy manual where i can get functions to accomplish root mean square calculations ... (i know this can be accomplished using np.mean and
For rms, the fastest expression I have found for small x.size
(~ 1024) and real x
is:
def rms(x):
return np.sqrt(x.dot(x)/x.size)
This seems to be around twice as fast as the linalg.norm
version (ipython %timeit on a really old laptop).
If you want complex arrays handled more appropriately then this also would work:
def rms(x):
return np.sqrt(np.vdot(x, x)/x.size)
However, this version is nearly as slow as the norm
version and only works for flat arrays.