Mercurial > hg > octave-lyh
diff scripts/linear-algebra/norm.m @ 2311:2b5788792cad
[project @ 1996-07-11 20:18:38 by jwe]
author | jwe |
---|---|
date | Thu, 11 Jul 1996 20:18:38 +0000 |
parents | 5cffc4b8de57 |
children | 5ca126254d15 |
line wrap: on
line diff
--- a/scripts/linear-algebra/norm.m +++ b/scripts/linear-algebra/norm.m @@ -17,33 +17,33 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. -function retval = norm (x, p) +## usage: norm (x, p) +## +## Compute the p-norm of x. +## +## If x is a matrix: +## +## value of p norm returns +## ---------- ------------ +## 1 1-norm, the largest column sum of x +## 2 largest singular value of x +## Inf infinity norm, the largest row sum of x +## "inf" same as Inf +## "fro" Frobenius norm of x, sqrt (sum (diag (x' * x))) +## +## If x is a vector or a scalar: +## +## value of p norm returns +## ---------- ------------ +## Inf max (abs (x)) +## -Inf min (abs (x)) +## other p-norm of x, sum (abs (x) .^ p) ^ (1/p) +## +## If the second argument is missing, p = 2 is assumed. +## +## See also: cond, svd - ## usage: norm (x, p) - ## - ## Compute the p-norm of x. - ## - ## If x is a matrix: - ## - ## value of p norm returns - ## ---------- ------------ - ## 1 1-norm, the largest column sum of x - ## 2 largest singular value of x - ## Inf infinity norm, the largest row sum of x - ## "inf" same as Inf - ## "fro" Frobenius norm of x, sqrt (sum (diag (x' * x))) - ## - ## If x is a vector or a scalar: - ## - ## value of p norm returns - ## ---------- ------------ - ## Inf max (abs (x)) - ## -Inf min (abs (x)) - ## other p-norm of x, sum (abs (x) .^ p) ^ (1/p) - ## - ## If the second argument is missing, p = 2 is assumed. - ## - ## See also: cond, svd +function retval = norm (x, p) if (nargin < 1 || nargin > 2) error ("usage: norm (x [, p])");