I am on the fence about this; it is occasionally useful but also quite easy to implement when needed, so I would tend to agree with @DNF here. Also,
a = norm(v)
v /= a
is not much more complicated — I don’t really mind naming interim values (v = A*x
), which can actually make the code cleaner.
As pointed out by @mzaffalon, normalize!
does have a clever trick to fix a numerical issue. But the solution could be just exposing that, eg with
a = norm(v, p)
v2 = normalize_with(v, a)
etc, as it may be useful in other contexts.