Movatterモバイル変換


[0]ホーム

URL:


rdrr.io

backsolve: Solve an Upper or Lower Triangular System

backsolveR Documentation

Solve an Upper or Lower Triangular System

Description

Solves a triangular system of linear equations.

Usage

   backsolve(r, x, k = ncol(r), upper.tri = TRUE,             transpose = FALSE)forwardsolve(l, x, k = ncol(l), upper.tri = FALSE,             transpose = FALSE)

Arguments

r, l

an upper (or lower) triangular matrix giving thecoefficients for the system to be solved. Values below (above)the diagonal are ignored.

x

a matrix whose columns give the right-hand sides forthe equations.

k

The number of columns ofr and rows ofx to use.

upper.tri

logical; ifTRUE (default), theuppertriangular part ofr is used. Otherwise, the lower one.

transpose

logical; ifTRUE, solver' * y = x fory, i.e.,t(r) %*% y == x.

Details

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

x <- backsolve (R, b) solvesR x = b, and
x <- forwardsolve(L, b) solvesL x = b, respectively.

Ther/l must have at leastk rows and columns,andx must have at leastk rows.

This is a wrapper for the level-3 BLAS routinedtrsm.

Value

The solution of the triangular system. The result will be a vector ifx is a vector and a matrix ifx is a matrix.

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)The New S Language.Wadsworth & Brooks/Cole.

Dongarra, J. J., Bunch, J. R., Moler, C. B. and Stewart, G. W. (1978)LINPACK Users Guide. Philadelphia: SIAM Publications.

See Also

chol,qr,solve.

Examples

## upper triangular matrix 'r':r <- rbind(c(1,2,3),           c(0,1,1),           c(0,0,2))( y <- backsolve(r, x <- c(8,4,2)) ) # -1 3 1r %*% y # == x = (8,4,2)backsolve(r, x, transpose = TRUE) # 8 -12 -5

What can we improve?

R Package Documentation

Browse R Packages

We want your feedback!

Note that we can't provide technical support on individual packages. You should contact the package authors for that.

 
Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, readEmbedding Snippets.

Close

[8]ページ先頭

©2009-2026 Movatter.jp