Coder Social home page Coder Social logo

nk027 / sanic Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 1.0 131 KB

Fast routines for solving large systems of linear equations in R. Makes Eigen Cholesky-, LU-, QR-, and iterative (Conjugate Gradient, BiCGSTAB) solvers for both dense and sparse problems available.

Home Page: https://cran.r-project.org/package=sanic

License: Other

R 36.97% C++ 63.03%
solvers bicgstab cholesky conjugate-gradient eigen linear-equations

sanic's Introduction

sanic: Solving Ax = b Nimbly in C++

CRAN month total

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.

Installation

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

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

Usage

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.

Solvers

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

Eigenproblems

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

sanic's People

Contributors

nk027 avatar odnaudio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

iscaswcm

sanic's Issues

Return failed CG guess

Currently, CG estimates that fail to converge lead to an error. It might make sense to change this to a warning, and return the latest guess -- especially if the number of iterations is capped. Happens here:

Rcpp::stop("Solving failed.");

Allow more interfacing

Atm a matrix is fed in and a result is fed out. Would be interesting to cache decompositions and interface more directly with Eigen.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.