This generic function solves the equation
a %*% x = b for
b can be either a vector or a matrix. This implementation is similar to
solve, but uses a pseudo-inverse if the system is computationally singular.
psolve(a, b, tol)
a rectangular numeric matrix containing the coefficients of the linear system.
a numeric vector or matrix giving the right-hand side(s) of the linear system. If missing,
the tolerance for detecting linear dependencies in the columns of a. The default is
a is a symmetric matrix,
eigen is used to compute the (pseudo-)inverse. This assumes that
a is a positive semi-definite matrix. Otherwise
svd is used to compute the (pseudo-)inverse for rectangular matrices.
b is missing, returns the (pseudo-)inverse of
a. Otherwise returns
psolve(a) %*% b.
The pseudo-inverse is calculated by inverting the eigen/singular values that are greater than the first value multiplied by
tol * min(dim(a)).
Nathaniel E. Helwig <email@example.com>
Moore, E. H. (1920). On the reciprocal of the general algebraic matrix. Bulletin of the American Mathematical Society, 26, 394-395. doi: 10.1090/S0002-9904-1920-03322-7
Penrose, R. (1955). A generalized inverse for matrices. Mathematical Proceedings of the Cambridge Philosophical Society, 51(3), 406-413. doi: 10.1017/S0305004100030401
1 2 3 4 5 6 7 8 9 10
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.