7.8 Inner Product Space Operations
The following functions treat matrices as vectors in an inner product space. It often makes most sense to use these vector-space functions only for row matrices and column matrices, which are essentially vectors as we normally think of them. There are exceptions, however, such as the fact that the Frobenius or Euclidean norm (implemented by matrix-2norm) can be used to measure error between matrices in a way that meets certain reasonable criteria (specifically, it is submultiplicative).
See Operator Norms and Comparing Matrices for similar functions (e.g. norms and angles) defined by considering matrices as operators between inner product spaces consisting of column matrices.
procedure
(matrix-1norm M) → Nonnegative-Real
M : (Matrix Number)
procedure
(matrix-2norm M) → Nonnegative-Real
M : (Matrix Number)
procedure
M : (Matrix Number)
procedure
(matrix-norm M [p]) → Nonnegative-Real
M : (Matrix Number) p : Real = 2
The L1 norm is also known under the names Manhattan or taxicab norm. The L1 norm of a matrix is the sum of magnitudes of the entries in the matrix.
The L2 norm is also known under the names Euclidean or Frobenius norm. The L2 norm of a matrix is the square root of the sum of squares of magnitudes of the entries in the matrix.
The L∞ norm is also known as the maximum or infinity norm. The L∞ norm computes the maximum magnitude of the entries in the matrix.
For p >= 1, matrix-norm computes the Lp norm: the pth root of the sum of all entry magnitudes to the pth power.
Examples: | ||||||||||
|
procedure
(matrix-dot M) → Nonnegative-Real
M : (Matrix Number) (matrix-dot M N) → Number M : (Matrix Number) N : (Matrix Number)
Examples: | ||||
|
(/ (matrix-dot M N) (* (matrix-2norm M) (matrix-2norm N)))
Examples: | ||||||||||
|
Examples: | |||||||||||||
|
procedure
(matrix-normalize M [p fail]) → (U F (Matrix Number))
M : (Matrix Number) p : Real = 2 fail : (-> F) = (λ () (error ...))
Examples: | |||||||||
|
procedure
(matrix-normalize-rows M [p fail]) → (Matrix Number)
M : (Matrix Number) p : Real = 2 fail : (-> F) = (λ () (error ...))
procedure
(matrix-normalize-cols M [p fail]) → (Matrix Number)
M : (Matrix Number) p : Real = 2 fail : (-> F) = (λ () (error ...))
Examples: | ||||||||||||
|
procedure
(matrix-rows-orthogonal? M [eps]) → Boolean
M : (Matrix Number) eps : Real = (* 10 epsilon.0)
procedure
(matrix-cols-orthogonal? M [eps]) → Boolean
M : (Matrix Number) eps : Real = (* 10 epsilon.0)
Examples: | ||||
|