Navigation

Operators and Keywords

Function List:

C++ API

Built-in Function: norm (A)

Built-in Function: norm (A, p)

Built-in Function: norm (A, p, opt)

Compute the p-norm of the matrix A. If the second argument is missing, p = 2 is assumed.

If A is a matrix (or sparse matrix):

p = 1
1-norm, the largest column sum of the absolute values of A.
p = 2
Largest singular value of A.
p = Inf or "inf"
Infinity norm, the largest row sum of the absolute values of A.
p = "fro"
Frobenius norm of A, sqrt (sum (diag (A' * A))).
other p, p > 1
maximum norm (A*x, p) such that norm (x, p) == 1

If A is a vector or a scalar:

p = Inf or "inf"
max (abs (A)).
p = -Inf
min (abs (A)).
p = "fro"
Frobenius norm of A, sqrt (sumsq (abs (A))).
p = 0
Hamming norm - the number of nonzero elements.
other p, p > 1
p-norm of A, (sum (abs (A) .^ p)) ^ (1/p).
other p p < 1
the p-pseudonorm defined as above.

If opt is the value "rows", treat each row as a vector and compute its norm. The result is returned as a column vector. Similarly, if opt is "columns" or "cols" then compute the norms of each column and return a row vector.

See also: cond, svd.

Package: octave