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

