null_complement {mcompanion} | R Documentation |
Compute the orthogonal complement of a subspace
Description
Computes the orthogonal complement of a subspace relative to a universe.
Usage
null_complement(m, universe = NULL, na.allow = TRUE)
Arguments
m |
NA or a matrix whose columns define the subspace, a vector is treated as a matrix with one column. |
universe |
a matrix whose columns specify the subspace relative to which to compute the complement, the default is the full space. |
na.allow |
if |
Details
null_complement
computes the orthogonal complement of a
subspace (spanned by the columns of m
) relative to a universe.
Argument universe
can be used to specify a subspace w.r.t.
which to compute the complement. If universe
is NULL
(the default), the complement w.r.t. the full space is computed. The
full space is the n
-dimensional space, where n
is the
number of rows of argument m
.
null_complement
returns a matrix whose columns give a basis of
the required subspace.
null_complement
uses Null()
from package MASS for the
actual computation. null_complement(m, na.allow = FALSE)
is
equivalent to Null(m)
.
m
is typically a matrix whose columns represent the subspace
w.r.t. which to compute the complement.
null_complement
can also deal with NA's in m
. This
facility can be turned off by specifying na.allow = FALSE
.
If na.allow = TRUE
, the default, and m
is identical to
NA
, universe
is returned (i.e. m = NA
represents
the empty subspace). Note that in this case universe
cannot be
NULL, since there is no way to determine the dimension of the full
space.
Otherwise, m
is a matrix. If all elements of m
are
NA
, a matrix of NA's is returned with number of columns equal
to ncol(universe) - ncol(m)
.
Value
a matrix representing a basis of the requested subspace
Author(s)
Georgi N. Boshnakov
Examples
m1 <- diag(1, nrow = 3, ncol = 2)
null_complement(m1)
null_complement(c(1,1,0))
null_complement(c(1,1,0), m1)
## the columns of the result from null_complement() are orthogonal
## to the 1st argument:
t(c(1,1,0)) %*% null_complement(c(1,1,0))
t(c(1,1,0)) %*% null_complement(c(1,1,0), m1)
null_complement(rep(NA_real_, 3), m1)
null_complement(NA, m1)