backsolve                package:base                R Documentation

_S_o_l_v_e _a_n _U_p_p_e_r _o_r _L_o_w_e_r _T_r_i_a_n_g_u_l_a_r _S_y_s_t_e_m

_D_e_s_c_r_i_p_t_i_o_n:

     Solves a system of linear equations where the coefficient matrix
     is upper or lower triangular.

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

     r,l: an upper (or lower) triangular matrix giving the coefficients
          for the system to be solved.  Values below (above) the
          diagonal are ignored.

       x: a matrix whose columns give "right-hand sides" for the
          equations.

       k: The number of columns of 'r' and rows of 'x' to use.

upper.tri: logical; if 'TRUE' (default), the _upper_ _tri_angular part
          of 'r' is used.  Otherwise, the lower one.

transpose: logical; if 'TRUE', solve r' * y = x for y, i.e., 't(r) %*%
          y == x'.

_V_a_l_u_e:

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

_R_e_f_e_r_e_n_c_e_s:

     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.

_S_e_e _A_l_s_o:

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

_E_x_a_m_p_l_e_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)
     backsolve(r, x, transpose = TRUE) # 8 -12 -5

