

ginv(MASS)                                   R Documentation

_G_e_n_e_r_a_l_i_z_e_d _I_n_v_e_r_s_e _o_f _a _M_a_t_r_i_x

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

     Calculates the Moore-Penrose generalized inverse of a
     matrix `X'.

_U_s_a_g_e_:

     ginv(X, tol=sqrt(.Machine$double.eps))

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

       X: Matrix for which the Moore-Penrose inverse is
          required.

     tol: A relative tolerance to detect zero singular val-
          ues.

_V_a_l_u_e_:

     A MP generalized inverse matrix for `X'.

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

     Venables  Ripley, Chapter 2.

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

     `solve', `svd', `eigen'

_E_x_a_m_p_l_e_s_:

     # The function is currently defined as
     function(X, tol = sqrt(.Machine$double.eps))
     {
     ## Generalized Inverse of a Matrix
       dnx <- dimnames(X)
       if(is.null(dnx)) dnx <- vector("list", 2)
       s <- svd(X)
       nz <- s$d > tol * s$d[1]
       structure(
         if(any(nz)) s$v[, nz] %*% (t(s$u[, nz])/s$d[nz]) else X,
         dimnames = dnx[2:1])
     }

