sparse_cg: Conjugate Gradient solver for Sparse Matrices.

Description Usage Arguments Value See Also

View source: R/RcppExports.R

Description

Using the iterative Conjugate Gradient Solver from the Eigen C++ library it solves a linear system A * x = b. Currently, it uses a diagonal preconditioner.

Usage

1
sparse_cg(A, b, x0, maxiter = 10000L, tol = 1e-06)

Arguments

A

Sparse double matrix of class dgCMatrix.

b

Numeric vector with length equal to number of rows of A.

x0

Numeric vector with same length as b. If no initial guess is known a vector of zeros with length of b can be passed.

maxiter

Integer scalar that sets the maximum number of iterations allowed by the solver. Default is 10,000.

tol

Sets the tolerance threshold (upper bound to the relative residual error) used by the stopping criteria.

Value

sparse_cg returns a list with several components:

coefficients

a vector with the estimated coefficients

itr

a scalar denoting the number of iterations at convergence

err

a scalar denoting the relative error at convergance

See Also

See Eigen Library for more documentation on solver used and other available solvers.


tstev/tstevR documentation built on May 18, 2020, 10:57 p.m.