

backsolve {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

_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)

_V_a_l_u_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_e_f_e_r_e_n_c_e_s_:

     Dongarra, J. J., J. R. Bunch, C. B. Moler and G. W.
     Stewart (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)
     ( 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))

