| Line 14... |
Line 14... |
| 14 |
% Name 'r' is not really making sense for upper.tri = FALSE
|
14 |
% Name 'r' is not really making sense for upper.tri = FALSE
|
| 15 |
% Name 'x' is also a misnomer, should rather be 'b'. -- is this S ??
|
15 |
% Name 'x' is also a misnomer, should rather be 'b'. -- is this S ??
|
| 16 |
\item{r,l}{an upper (or lower) triangular matrix giving the
|
16 |
\item{r,l}{an upper (or lower) triangular matrix giving the
|
| 17 |
coefficients for the system to be solved. Values below (above)
|
17 |
coefficients for the system to be solved. Values below (above)
|
| 18 |
the diagonal are ignored.}
|
18 |
the diagonal are ignored.}
|
| 19 |
\item{x}{a matrix whose columns give ``right-hand sides'' for
|
19 |
\item{x}{a matrix whose columns give \dQuote{right-hand sides} for
|
| 20 |
the equations.}
|
20 |
the equations.}
|
| 21 |
\item{k}{The number of columns of \code{r} and rows of \code{x} to use.}
|
21 |
\item{k}{The number of columns of \code{r} and rows of \code{x} to use.}
|
| 22 |
\item{upper.tri}{logical; if \code{TRUE} (default), the \emph{upper}
|
22 |
\item{upper.tri}{logical; if \code{TRUE} (default), the \emph{upper}
|
| 23 |
\emph{tri}angular part of \code{r} is used. Otherwise, the lower one.}
|
23 |
\emph{tri}angular part of \code{r} is used. Otherwise, the lower one.}
|
| 24 |
\item{transpose}{logical; if \code{TRUE}, solve \eqn{r' * y = x} for
|
24 |
\item{transpose}{logical; if \code{TRUE}, solve \eqn{r' * y = x} for
|
| Line 40... |
Line 40... |
| 40 |
\code{\link{chol}},
|
40 |
\code{\link{chol}},
|
| 41 |
\code{\link{qr}},
|
41 |
\code{\link{qr}},
|
| 42 |
\code{\link{solve}}.
|
42 |
\code{\link{solve}}.
|
| 43 |
}
|
43 |
}
|
| 44 |
\examples{
|
44 |
\examples{
|
| 45 |
## upper triangular matrix `r':
|
45 |
## upper triangular matrix 'r':
|
| 46 |
r <- rbind(c(1,2,3),
|
46 |
r <- rbind(c(1,2,3),
|
| 47 |
c(0,1,1),
|
47 |
c(0,1,1),
|
| 48 |
c(0,0,2))
|
48 |
c(0,0,2))
|
| 49 |
( y <- backsolve(r, x <- c(8,4,2)) ) # -1 3 1
|
49 |
( y <- backsolve(r, x <- c(8,4,2)) ) # -1 3 1
|
| 50 |
r \%*\% y # == x = (8,4,2)
|
50 |
r \%*\% y # == x = (8,4,2)
|