Movatterモバイル変換


[0]ホーム

URL:


sanic: Solving Ax = b Nimbly inC++

CRANmonthtotal

Routines for solving large systems of linear equations inR. Direct and iterative solvers from theEigenC++ library are made available. Solvers includeCholesky, LU, QR, and Krylov subspace methods (Conjugate Gradient,BiCGSTAB). Both dense and sparse problems are supported.

Installation

sanic is available onCRAN. Thedevelopment version can be installed from GitHub.

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

Usage

To solve a linear system of equations, use thesolve2()function for automatic dispatch to a specific solver or access the LU,QR, Cholesky or Conjugate Gradient solvers directly.

To solve an eigenproblem, use theeigen2() orsvd2() functions, or thearnoldi()function.

Solvers

SolverFunctionNotesSparseReference
LU decompositionsolve_lu()Partial pivoting, full pivotingYes1,2,3
Householder QR decompositionsolve_qr()Column pivoting, full pivoting, no pivotingYes1,2,3,4
Cholesky decompositionsolve_chol()LDLT for semidefinite problems, LLT for positive definiteproblemsYes1,23,4
Conjugate Gradient (CG)solve_cg()Biconjugate gradient stabilised (BiCGTAB) for square problems, leastsquares (LSCG) for rectangular problems, classic CG for symmetricpositive definite problems, preconditionersAlways1,2,3

Eigenproblems

SolverFunctionNotesSparseReference
Spectral decompositioneigen2()Square and symmetric problemsNo1,2
Singular value decompositionsvd2()Bidiagonal Divide and Conquer SVD for large and Jacobi SVD for smallproblemsNo1,2
Arnoldi iterationarnoldi()Square problems using an iteratively constructed HessenbergmatrixAlways1
Lanczos algorithmlanczos()Symmetric problems using an iteratively constructed tridiagonalmatrixAlways1

[8]ページ先頭

©2009-2025 Movatter.jp