bandsolve: bandsolve

View source: R/bandsolve.R

bandsolveR Documentation

bandsolve

Description

Main function to solve efficiently and quickly a symmetric bandlinear system. Theses systems are solved much faster than standards system, dropping from complexity O(n³) to O(0.5*nk²), where k is the number of sub diagonal.

Usage

bandsolve(A, b = NULL, inplace = FALSE)

Arguments

A

Band square matrix in rotated form. The rotated form can be obtained with the function as.rotated: it's the visual rotation by 90 degrees of the matrix, where subdiagonal are discarded.

b

right hand side of the equation. Can be either a vector or a matrix. If not supplied, the function return the inverse of A.

inplace

Should results overwrite pre-existing data? Default set to false.

Value

Solution of the linear problem.

Examples


A = diag(4)
A[2,3] = 2
A[3,2] = 2
R = mat2rot(A)
solve(A)
bandsolve(R)

set.seed(100)

n = 1000
D0 = rep(1.25, n)
D1 = rep(-0.5, n-1)
b = rnorm(n)

aspline documentation built on June 9, 2022, 9:05 a.m.