R: Solve an Upper or Lower Triangular System

backsolve {bdsmatrix} | R Documentation

## 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 signature 'gchol'
    backsolve(r, x, k=ncol(r), upper.tri=TRUE, ...)
      ## S4 method for signature 'gchol.bdsmatrix'
    backsolve(r, x, k=ncol(r), upper.tri=TRUE, ...)

### 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

### Details

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

### 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)`.

### 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

### Note

The `bdsmatrix` package promotes the base R `backsolve` function to a generic. To see the full documentation for the default method, view `backsolve` from the `base` package.

### See Also

`forwardsolve`, `gchol`

[Package bdsmatrix version 1.3-2 Index]