[Numpy-discussion] efficient norm of a vector

lorenzo bolla lbolla at gmail.com
Tue Mar 13 12:09:40 EDT 2007


Hi all,
just a quick (and easy?) question.
what is the best (fastest) way to implement the euclidean norm of a vector,
i.e. the function:

import scipy as S
def norm(x):
   """normalize a vector."""
   return S.sqrt(S.sum(S.absolute(x)**2))

?

thanks in advance,
Lorenzo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070313/83cb6701/attachment.html>


More information about the NumPy-Discussion mailing list