Solve S b = x

DESCRIPTION:

Solves S b = x for b, where S is a sparse matrix obtained from an object of class spatial.neighbor.

USAGE:

spatial.cg.solve(neighbor, x, transpose=F, print.level=F, rho=0, 
                 product=F, region.id=NULL) 

REQUIRED ARGUMENTS:

neighbor
an object of class "spatial.neighbor" containing the sparse matrix representation of the spatial neighbor matrix (or matrices, see function spatial.neighbor).
x
the right hand side for which a solution is desired. Alternatively, x can be a matrix. In this case, a solution is obtained for each column in x.

OPTIONAL ARGUMENTS:

transpose
with the default arguments, S is taken as I minus the sum over i of rho[i] A[i]. Here I is an identity matrix, rho[i] is a scalar, and A[i] is the i-th weight matrix in neighbor. If transpose is T, then the transpose of this matrix is used for A.
print.level
if TRUE, information regarding the iterative process is printed as the iterations are performed. This allows you to better judge the adequacy of the solution.
rho
a scalar (or vector) of constants used in defining the matrix S (see argument transpose).
product
let B be I - sum rho[i] A[i] as described in argument transpose. When product is FALSE, S = B. When product is TRUE, S is t(B) times B.
region.id
a vector with length equal to the number of regions in the spatial lattice. If variables row.id and col.id of argument neighbor are not integer valued variables with sequential values from 1 to the number or regions in the lattice, then argument region.id must be specified and is used to obtain a sequential coding of the lattice regions.

VALUE:

a matrix (or vector), b, solving the linear system S b = x.

DETAILS:

A iterative algorithm due to M. A. Saunders (see Paige and Saunders, 1975) is used to solve the linear system. This algorithm requires the matrix products S y, for vector y. In spatial.cg.solve this product is computed using the same algorithms as in routine spatial.multiply. The Paige and Saunders algorithm is a variant of a conjugate gradient algorithm.

REFERENCES:

Lewis, J. G.(1977). "Algorithms for Sparse Matrix Eigenvalue Problems". Report STAN-CS-77-595, Computer Science Department, Stanford University, Stanford, California

Paige, C. C. and Saunders, M. A. (1975). Solution of sparse indefinite systems of linear equations. SIAM J. Numer. Anal. 12, 617-629.

SEE ALSO:

, .

EXAMPLES:

row.id <- c(1,1,2,2,3) 
col.id <- c(1,3,1,3,4) 
rhs <- 1:4 
neighbor <- spatial.neighbor(row.id=row.id, col.id=col.id, symmetric=T) 
spatial.cg.solve(neighbor, rhs, rho= -0.7)