pnull {nlsic} | R Documentation |
Particular least-squares solution and Null-space basis
Description
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)
.
Usage
pnull(A, b = NULL, qrat = NULL, rcond = 1e+10, keepqr = FALSE)
Arguments
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 |
Value
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.
See Also
Examples
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)))
[Package nlsic version 1.1.1 Index]