## NORM Norm Calculation

Section: Array Generation and Manipulations

### Usage

Calculates the norm of a matrix. There are two ways to use the `norm` function. The general syntax is

       y = norm(A,p)

where `A` is the matrix to analyze, and `p` is the type norm to compute. The following choices of `p` are supported

- `p = 1` returns the 1-norm, or the max column sum of A
- `p = 2` returns the 2-norm (largest singular value of A)
- `p = inf` returns the infinity norm, or the max row sum of A
- `p = 'fro'` returns the Frobenius-norm (vector Euclidean norm, or RMS value)

For a vector, the regular norm calculations are performed:

- `1 <= p < inf` returns `sum(abs(A).^p)^(1/p)`
- `p` unspecified returns `norm(A,2)`
- `p = inf` returns max(abs(A))
- `p = -inf` returns min(abs(A))

### Examples

Here are the various norms calculated for a sample matrix

    --> A = float(rand(3,4))

    A =

        0.2751    0.5250    0.0532    0.8315
        0.9886    0.7171    0.6396    0.5145
        0.5634    0.9679    0.7133    0.0706

    --> norm(A,1)

    ans =

        2.2099

    --> norm(A,2)

    ans =

        2.0674

    --> norm(A,inf)

    ans =

        2.8597

    --> norm(A,'fro')

    ans =

        2.2313

Next, we calculate some vector norms.

    --> A = float(rand(4,1))

    A =

        0.0288
        0.6311
        0.4853
        0.6145

    --> norm(A,1)

    ans =

        1.7596

    --> norm(A,2)

    ans =

        1.0061

    --> norm(A,7)

    ans =

        0.6962

    --> norm(A,inf)

    ans =

        0.6311

    --> norm(A,-inf)

    ans =

     2.8751e-02