The normalize() function is designed to work on vectors, or
lists-of-vectors. When numpy sees a list-of-vectors it interprets it as
a matrix, which changes the default norm from 2-norm to Frobenius norm
[1]. Specific the ord parameter fixes this issue, and removes the need
for a less-than-eps special case.
The normalize() function is designed to work on vectors, or lists-of-vectors. When numpy sees a list-of-vectors it interprets it as a matrix, which changes the default norm from 2-norm to Frobenius norm [1]. Specific the ord parameter fixes this issue, and removes the need for a less-than-eps special case.
[1] https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html