m3sh.linalg.

unit#

unit(u)#

Vector normalization.

Convenience function to normalize a vector.

Parameters:
undarray, shape (n,)

Vector with n components.

Returns:
ndarray, shape (n,)

Normalized copy of input vector. The input vector u remains unchanged.

See also

unit_inplace

Notes

No error checking (division by zero, etc) is performed. Trying to normalize the zero vector results in a vector of nan values.