NullC {rstiefel} | R Documentation |
Given a matrix M
, find a matrix N
giving a basis for the null
space. This is a modified version of Null from the package MASS.
NullC(M)
M |
input matrix. |
an orthonormal matrix such that t(N)%*%M
is a matrix of
zeros.
The MASS function Null(matrix(0,4,2))
returns a 4*2 matrix,
whereas NullC(matrix(0,4,2))
returns diag(4)
.
Peter Hoff
NullC(matrix(0,4,2))
## The function is currently defined as
function (M)
{
tmp <- qr(M)
set <- if (tmp$rank == 0L)
1L:nrow(M)
else -(1L:tmp$rank)
qr.Q(tmp, complete = TRUE)[, set, drop = FALSE]
}