norms of a vector or a matrix
y = norm(x) y = norm(x, normType)
vector or matrix of real or complex numbers (full or sparse storage)
x
: a number among
1, 2, %inf, -%inf
, or a word among
"inf"
(or "i"
) or
"fro"
(or "f"
).x
: any number or %inf
,
-%inf
; or a word "inf"
("i"
), "fro"
("f"
).norm: single positive real number.
For matrices
or norm(x,2)
is the largest singular value
of x
(max(svd(x))
).
The l_1 norm x
(the largest column sum :
max(sum(abs(x),'r'))
).
The infinity norm of x
(the largest row sum :
max(sum(abs(x),'c'))
).
Frobenius norm i.e. sqrt(sum(diag(x'*x)))
.
For vectors
The l_p norm sum(abs(v(i))^p)^(1/p)
.
The l_2 norm
max(abs(v(i)))
.
norm([])
and norm([],p)
return 0.
norm(x)
and norm(x,p)
return NaN if x contains NaNs.