pnull | R Documentation |
use Lapack to find a particular solution xp
of under-determined least
squares system Ax=b
and build null space basis B
of A
(derived from MASS::Null). In such a way, a general solution is given by
x=xp+Bz
where z is an arbitrary vector of size ncol(A)-rank(A)
.
pnull(A, b = NULL, qrat = NULL, rcond = 1e+10, keepqr = FALSE)
A |
matrix (or its QR decomposition) such that |
b |
is the right hand side of the least squares system |
qrat |
is QR decomposition of |
rcond |
maximal condition number for rank definition |
keepqr |
if TRUE strore qr and qrat as attribute of B |
alist with xp and B, particular solution and numeric matrix
whose columns are basis vectors. If requested, attributes 'qr' and
'qrat' of B contain QR decomposition of A
and t(A)
respectively.
MASS::Null Nulla
A=diag(nrow=3L)[1:2,,drop=FALSE]
b=A%*%(1:3)
res=pnull(A, b)
stopifnot(all.equal(res$xp, c(1:2,0)))
stopifnot(all.equal(c(res$B), c(0,0,1)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.