This generic function solves the equation
a %*% x = b for
b can be either a vector or a matrix.
solve(a, b, ...) ## S3 method for class 'default': solve((a, b, tol, LINPACK = FALSE, ...))
- a square numeric or complex matrix containing the coefficients of the linear system.
- a numeric or complex vector or matrix giving the right-hand side(s) of the linear system. If missing,
bis taken to be an identity matrix and
solvewill return the inverse of
- the tolerance for detecting linear dependencies in the columns of
TRUEthe default is
1e-7, otherwise it is
.Machine$double.eps. Future versions of R may use a tighter tolerance. Not currently used with complex matrices
- logical. Should LINPACK be used (for compatibility with R < 1.7.0)? Otherwise LAPACK is used.
- further arguments passed to or from other methods
b can be complex, but this uses double complex arithmetic which might not be available on all platforms and LAPACK will always be used.
The row and column names of the result are taken from the column names of
a and of
b respectively. If
b is missing the column names of the result are the row names of
a. No check is made that the column names of
a and the row names of
b are equal.
a can be a (real) QR decomposition, although
qr.solve should be called in that case.
qr.solve can handle non-square systems.
Anderson. E. and ten others (1999) LAPACK Users' Guide. Third Edition. SIAM.
Available on-line at http://www.netlib.org/lapack/lug/lapack_lug.html. Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
LINPACK = TRUE (for compatibility with R < 1.7.0) was formally deprecated in R 2.15.2.
Documentation reproduced from R 2.15.3. License: GPL-2.