normalizerow
- compas.numerical.normalizerow(A, do_nan_to_num=True)[source]
Normalise the rows of matrix A.
- Parameters:
- Aarray
Matrix A represented as an (m x n) array.
- do_nan_to_numbool
Convert NaNs and INF to numbers, default=True.
- Returns:
- array
Matrix of normalized row vectors (m x n).
Notes
Normalises the row vectors of A by the normrows, i.e. creates an array of vectors where the row vectors have length of unity.
Tiling is not necessary, because of NumPy’s broadcasting behaviour.
Examples
>>> normalizerow(array([[2, -1, 3,], [1, 0, 1], [0, 2, -1]])) array([[ 0.53452248, -0.26726124, 0.80178373], [ 0.70710678, 0. , 0.70710678], [ 0. , 0.89442719, -0.4472136 ]])