Contents Previous Next Subchapters Current Chapters-> normfunction path defined variables error errortrap help loadsave garbage eval execmat execfile sprintf interrupt runall filediff update Parent Chapters-> Omatrix6 advanced normfunction Search Tools-> contents reference index search

Vector And Matrix Norms
 Syntax `norm( `x``` ) norm( ```x`, `p` )` See Also norm operator abs , max

Description
Returns the norm of x where x is an integer, real, double-precision, or complex matrix. If x is integer or real, the return value is a real scalar, otherwise the return value is a double-precision scalar. If the argument p is present, it can be a positive integer, real, or double-precision scalar. It can also be the character vectors "fro", "inf", or "-inf". ``` ```If x is an empty matrix , the return value is equal to zero.

Scalars
In all cases, the norm of a scalar is equal to its absolute value. If you enter ```      norm(-5) ``` O-Matrix will respond ```      5 ```
Vectors

Frobenius Norm
If x is a vector and p is equal to "fro", the Frobenius norm of x is computed. The Frobenius norm of x is the square root of the sum of the squares of the absolute value of the elements of x. For example ```      norm([3, 4], "fro") ``` will result in ```      5 ```
Maximum Norm
If x is a vector and p is equal to "inf" the return value is the maximum of the absolute value of the elements of x. For example ```      norm([3, 4], "inf") ``` will result in ```      4 ```
Minimum Norm
If x is a vector and p is equal to "-inf" the return value is the minimum of the absolute value of the elements of x. For example ```      norm([3, 4], "-inf") ``` will result in ```      3 ```
P-Norm
If x is a vector and p is a number other than plus or minus infinity, the return value is equal to ```      /  p    p          p \ (1/p)      | x  + x  + ... + x  |      \  1    2          n / ```
Matrices

Euclidian Norm
If x is not a vector or an empty matrix and p is not present or it is equal to 2, the return value is the maximum absolute singular value corresponding to the matrix x. For example, ```      x = { ...           [3, 0], ...           [0, 4] ...      }       norm(x) ``` will result in ```      4 ```
Frobenius Norm
If x is not a vector or an empty matrix and p is equal to "fro", the Frobenius norm of x is computed. The Frobenius norm of x is the square root of the sum of the squares of the absolute value of the elements of x. For example ```      x = { ...           [3, 0], ...           [0, 4] ...      }       norm(x, "fro") ``` will result in ```      5 ```
One Norm
If x is not a vector or an empty matrix and p is equal to 1, the return value is the maximum with respect to the columns of x of the sum of the absolute value of the elements in each column. For example, ```      x = { ...           [1, 2], ...           [3, 4] ...      }       norm(x, 1) ``` will result in ```      6 ```
Infinity Norm
If x is not a vector or an empty matrix and p is equal to "inf", the return value is the maximum with respect to the rows of x of the sum of the absolute value of the elements in each row. For example, ```      x = { ...           [1, 2], ...           [3, 4] ...      }       norm(x, "inf") ``` will result in ```      7 ```
Reference
The values plus and minus infinity can be used in place of "inf" and "-inf" respectively.