JuliaLang/julia — pull request #6057 by stevengj (2014-03-05 03:59:30+00:00)
Title: add new vecnorm(x, p), generalizing and replacing normfro

As [discussed on the mailing list](https://groups.google.com/d/msg/julia-users/RJO-JCVV7rg/4qHjMbPd9YAJ), this adds a new `vecnorm(x,p)` function (generalizing and replacing `normfro`) which computes a p-norm of any iterable container as if it were a vector.

Along the way, I also made a few other improvements, e.g. the generic-`p` case no longer allocates temporary arrays, accumulation is done in double precision for `Float16` or `Float32` arrays (but the result is still returned as `Float16` or `Float32`), and `cheapnorm` in `quadgk` is eliminated in favor of `vecnorm`.

Also fixes #6056 (makes `norm` type-stable).