backsolve(r, x, k = ncol(r))
r
(even if
k
is smaller than
ncol(*)
). Missing values are not accepted.
r
to use in solving the system.
The first
k
columns are used.
x
of the solutions
y
to the equations r %*% y == x.
If
k
is smaller than the number of rows in
r
, then only the first
k
values are meaningful (the first
k
values in each column if
x
is a matrix).
The lower triangle of
r
is not looked at (in particular, it
does not need to be zero, but missing values are not allowed there).
Suitable
r
matrices can be obtained from
chol
and
qr
.
# create an upper triangular matrix amat <- matrix(c(3,0,0,1,1,0,4,5,9), nrow = 3) backsolve(amat, c(9,5,14))