JuliaLang/julia — pull request #2330 by lindahua (2013-02-16 20:01:10+00:00)
Title: RFC: Faster norm for vectors

Based on the discussion in #2324, I made the following changes:

* Introduce a BLAS function ``asum`` to ``blas.jl``, in a similar way that ``nrm2`` was introduced.

* Add a specialized method of ``norm(x, p)`` in ``linalg_dense.jl`` which provides optimized implementation for the cases where p = 2, 1, 0. In particular, ``BLAS.nrm2``, ``BLAS.asum`` and ``nnz`` are respectively used. For other values of p, it just did exactly the same thing that the generic version does.