norm

pyvsim.Utils.norm(vectors)[source]

This can be used to calculate the euclidean norm of vector or a list of vectors, provided they are given as numpy arrays.

Parameters :

vectors : numpy.ndarray \((N,3)\)

A list of vectors

Returns :

norms : numpy.ndarray \((N)\)

A list with the euclidean norm of the vectors

Examples

>>> inp = norm(np.array([1,1,0]))
>>> out = np.sqrt(2)
>>> assert(aeq(inp, out))

And for multiple vectors:

>>> inp = norm(np.array([[1,1,0],
...                      [1,1,1]]))
>>> out = np.array([np.sqrt(2), 
...                 np.sqrt(3)])
>>> assert(aeq(inp, out))

This Page