Learn R Programming

bdsmatrix (version 1.3-7)

backsolve: Solve an Upper or Lower Triangular System

Description

Solves a system of linear equations where the coefficient matrix is upper (or ‘right’, ‘R’) or lower (‘left’, ‘L’) triangular.

x <- backsolve(R, b) solves \(R x = b\).

Usage

backsolve(r, ...)
  # S4 method for gchol
backsolve(r, x, k=ncol(r), upper.tri=TRUE, ...)
  # S4 method for gchol.bdsmatrix
backsolve(r, x, k=ncol(r), upper.tri=TRUE, ...)

Value

The solution of the triangular system. The result will be a vector if

x is a vector and a matrix if x is a matrix.

Note that forwardsolve(L, b) is just a wrapper for

backsolve(L, b, upper.tri=FALSE).

Arguments

r

a matrix or matrix-like object

x

a vector or a matrix whose columns give the right-hand sides for the equations.

k

The number of columns of r and rows of x to use.

upper.tri

logical; if TRUE (default), the upper triangular part of r is used. Otherwise, the lower one.

...

further arguments passed to other methods

Methods

Use showMethods(backsolve) to see all the defined methods; the two created by the bdsmatrix library are described here:

bdsmatrix

signature=(r= "gchol") for a generalized cholesky decomposition

bdsmatrix

signature=(r= "gchol.bdsmatrix") for the generalize cholesky decomposition of a bdsmatrix object

Details

The generalized Cholesky decompostion of a symmetric matrix A is \(A = LDL'\) where D is diagonal, L is lower triangular, and \(L'\) is the transpose of L. These functions solve either \(L\sqrt{D} x =b\) (when upper.tri=FALSE) or \(\sqrt{D}L' x=b\).

See Also