def vector_norm(data, axis=None, out=None):
 data = numpy.array(data, dtype=numpy.float64, copy=True)
 if (out is None):
  if (data.ndim == 1):
   return math.sqrt(numpy.dot(data, data))
  data *= data
  out = numpy.atleast_1d(numpy.sum(data, axis=axis))
  numpy.sqrt(out, out)
  return out
 else:
  data *= data
  numpy.sum(data, axis=axis, out=out)
  numpy.sqrt(out, out)

def vector_norm ( data , axis = None , out = None ) : data = numpy . array ( data , dtype = numpy . float64 , copy = True ) if ( out is None ) : if ( data . ndim == 1 ) : return math . sqrt ( numpy . dot ( data , data ) ) data *= data out = numpy . atleast_1d ( numpy . sum ( data , axis = axis ) ) numpy . sqrt ( out , out ) return out else : data *= data numpy . sum ( data , axis = axis , out = out ) numpy . sqrt ( out , out )
return length .