Routines for solving large systems of linear equations in
**R**. Direct and iterative solvers from the *Eigen*
**C++** library are made available. Solvers include
Cholesky, LU, QR, and Krylov subspace methods (Conjugate Gradient,
BiCGSTAB). Both dense and sparse problems are supported.

**sanic** is available on CRAN. The
development version can be installed from GitHub.

```
install.packages("sanic")
::install_github("nk027/sanic") devtools
```

To solve a linear system of equations, use the `solve2()`

function for automatic dispatch to a specific solver or access the LU,
QR, Cholesky or Conjugate Gradient solvers directly.

To solve an eigenproblem, use the `eigen2()`

or
`svd2()`

functions, or the `arnoldi()`

function.

Solver | Function | Notes | Sparse | Reference |
---|---|---|---|---|

LU decomposition | `solve_lu()` |
Partial pivoting, full pivoting | Yes | 1, 2, 3 |

Householder QR decomposition | `solve_qr()` |
Column pivoting, full pivoting, no pivoting | Yes | 1, 2, 3, 4 |

Cholesky decomposition | `solve_chol()` |
LDLT for semidefinite problems, LLT for positive definite problems | Yes | 1, 2 3, 4 |

Conjugate Gradient (CG) | `solve_cg()` |
Biconjugate gradient stabilised (BiCGTAB) for square problems, least squares (LSCG) for rectangular problems, classic CG for symmetric positive definite problems, preconditioners | Always | 1, 2, 3 |

Solver | Function | Notes | Sparse | Reference |
---|---|---|---|---|

Spectral decomposition | `eigen2()` |
Square and symmetric problems | No | 1, 2 |

Singular value decomposition | `svd2()` |
Bidiagonal Divide and Conquer SVD for large and Jacobi SVD for small problems | No | 1, 2 |

Arnoldi iteration | `arnoldi()` |
Square problems using an iteratively constructed Hessenberg matrix | Always | 1 |

Lanczos algorithm | `lanczos()` |
Symmetric problems using an iteratively constructed tridiagonal matrix | Always | 1 |