Solve {limSolve}R Documentation

Generalised inverse solution of Ax=B

Description

Generalised inverse solution of

Ax=B


It uses the Moore-Penrose generalized inverse of matrix A (function ginv from package MASS).

Note: solve, the R default requires square, positive definite A. Solve does not have this restriction.

Usage

Solve(A, B=diag(nrow=nrow(A)), tol=sqrt(.Machine$double.eps))

Arguments

A numeric matrix containing the coefficients of the equation Ax=B
B numeric matrix containing the right-hand sides of the equation; the default is the unity matrix, in which case the function will return the Moore-Penrose generalized inverse of matrix A
tol tolerance for selecting singular values

Value

a vector with the generalised inverse solution

Author(s)

Karline Soetaert <k.soetaert@nioo.knaw.nl>

See Also

ginv to estimate the Moore-Penrose generalized inverse of a matrix, in package MASS,
solve the R default

Examples

A <- matrix(nrow=4,ncol=3,data=c(1:8,6,8,10,12)) # col3 = col1+col2
B <- 0:3
X <- Solve(A,B)            # generalised inverse solution
A %*% X - B                # should be zero (except for roundoff)
(gA <- Solve(A))           # generalised inverse of A

[Package limSolve version 1.3 Index]