

   backsolve {base}                             R Documentation

   SSoollvvee aann UUppppeerr oorr LLoowweerr TTrriiaanngguullaarr SSyysstteemm

   UUssaaggee::

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

   VVaalluuee::

        The solution of the triangular system.  The result will
        be a a vector if `x' is a vector and a matrix if `x' is
        a matrix.

   RReeffeerreenncceess::

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

   SSeeee AAllssoo::

        `chol', `qr', `solve'.

   EExxaammpplleess::

        ## 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)
        ( y2 <- backsolve(r, x, transpose = TRUE)) # 8 -12 -5
        all(t(r) %*% y2 == x)# exactly on Linux (Pentium)
        all(y  == backsolve(t(r), x, upper = FALSE, transpose = TRUE))
        all(y2 == backsolve(t(r), x, upper = FALSE,  transpose = FALSE))

