S b = x
S b = x for
b, where
S is a sparse matrix obtained from
an object of class
spatial.neighbor.
spatial.cg.solve(neighbor, x, transpose=F, print.level=F, rho=0,
product=F, region.id=NULL)
"spatial.neighbor" containing the sparse matrix
representation of the spatial neighbor matrix (or matrices, see function
spatial.neighbor).
x can
be a matrix. In this case, a solution is obtained for each column in
x.
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.
TRUE, information regarding the iterative process is printed as the
iterations are performed.
This allows you to better judge the adequacy of the solution.
S (see
argument
transpose).
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.
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.
b, solving the linear system
S b = x.
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.
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.
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)