backsolve(r, x, k = ncol(r), upper.tri = TRUE,
transpose = FALSE)
forwardsolve(l, x, k = ncol(l), upper.tri = FALSE,
transpose = FALSE)
r
and rows of x
to use.TRUE
(default), the upper
triangular part of r
is used. Otherwise, the lower one.TRUE
, solve t(r) %*% y == x
.x
is a vector and a matrix if x
is a matrix.x <- backsolve (R, b)
solves x <- forwardsolve(L, b)
solves r
/l
must have at least k
rows and columns,
and x
must have at least k
rows. This is a wrapper for the level-3 BLAS routine dtrsm
.chol
,
qr
,
solve
.## 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 1
r %*% y # == x = (8,4,2)
backsolve(r, x, transpose = TRUE) # 8 -12 -5
Run the code above in your browser using DataLab