Learn R Programming

Matrix (version 0.3-19)

Orthonormal.test: Check for Orthogonality or Orthonormality

Description

Check for column (or row) orthogonality (or orthonormality) in a matrix or return the numerical value used to perform this check.

Usage

is.Orthonormal(x, tol = sqrt(.Machine$double.eps), byrow = FALSE)
is.ColOrthonormal(x, tol = sqrt(.Machine$double.eps))
is.RowOrthonormal(x, tol = sqrt(.Machine$double.eps))
Orthogonal.test(x, byrow = FALSE, normal = TRUE)
Orthonormal.test(x, byrow = FALSE)

Arguments

x
an numeric or complex matrix.
tol
tolerance in the test for orthonormality or orthogonality.
byrow
logical. If FALSE (the default) the columns are tested, otherwise the rows are tested.
normal
logical. If TRUE (the default) determine the maximum modulus of the deviation of the squared lengths of the columns (rows) from unity. Otherwise, determine only the maximum modulus of the inner products of distinct columns (rows).

Value

  • Orthonormal.test returns a numeric measure of the deviation of the columns (rows) of the matrix from orthogonality, when normal is FALSE, or orthonormality, when normal is TRUE. This value is always at least the maximum modulus of the inner products of distinct columns (rows). When normal it TRUE, it is the maximum of this value and the maximum modulus of the deviation of the squared lengths of the columns (rows) from unity. That is, when normal is TRUE the value the maximum modulus of the deviation of crossprod(x) from an identity matrix. is.Orthonormal, is.ColOrthonormal and is.RowOrthonormal return a logical value according to whether the columns (rows) of the matrix are orthonormal. These simply compare a result from Orthonormal.test with appropriate options to tol.

See Also

.Machine.

Examples

Run this code
v <- rnorm(3)
v <- v / norm(v, 'F')
x <- diag(3) - 2 * (v %*% t(v))
is.Orthonormal(x)  # should be TRUE
is.Orthonormal(x, tol = .Machine$double.eps)
is.Orthonormal(x, tol = sqrt(.Machine$double.eps))
Orthonormal.test(x)

Run the code above in your browser using DataLab