The argument A
can be a symmetric matrix or a symmetric sparse matrix
inheriting from "Matrix"
of the package Matrix. It can also be
a function which performs the matrix-vector product. If so, the function
must be able to take as input a matrix of column vectors.
If the matrix A
is rank deficient, some solution is returned. If
there is no solution, a vector is returned which may or may not be close to
a solution. If symmtest
is FALSE
, no check is performed that
A
is symmetric. If not symmetric, cgsolve
is likely to raise
an error about divergence.
The tolerance eps
is a relative tolerance, i.e. \(||x - x_0|| <
\epsilon ||x_0||\) where \(x_0\) is the true solution and \(x\) is the
solution returned by cgsolve
. Use a negative eps
for absolute
tolerance. The termination criterion for cgsolve
is the one from
Kaasschieter (1988), Algorithm 3.
Preconditioning is currently not supported.
If A
is a function, the test for symmetry is performed by drawing two
random vectors x,y
, and testing whether \(|(Ax, y) - (x, Ay)| <
10^{-6} sqrt((||Ax||^2 + ||Ay||^2)/N)\), where \(N\) is the vector length.
Thus, the test is neither deterministic nor perfect.