dpoMatrix-class            package:Matrix            R Documentation

_P_o_s_i_t_i_v_e _S_e_m_i-_d_e_f_i_n_i_t_e _D_e_n_s_e _N_u_m_e_r_i_c _M_a_t_r_i_c_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     The '"dpoMatrix"' class is the class of positive-semidefinite
     symmetric matrices in nonpacked storage. The '"dppMatrix"' class
     is the same except in packed storage. Only the upper triangle or
     the lower triangle is required to be available.

     The '"corMatrix"' class extends '"dpoMatrix"' with a slot 'sd'.

_O_b_j_e_c_t_s _f_r_o_m _t_h_e _C_l_a_s_s:

     Objects can be created by calls of the form 'new("dpoMatrix",
     ...)' or from 'crossprod' applied to an '"dgeMatrix"' object.

_S_l_o_t_s:


     '_u_p_l_o': Object of class '"character"'. Must be either "U", for
          upper triangular, and "L", for lower triangular.

     '_x': Object of class '"numeric"'. The numeric values that
          constitute the matrix, stored in column-major order.

     '_D_i_m': Object of class '"integer"'. The dimensions of the matrix
          which must be a two-element vector of non-negative integers.

     '_D_i_m_n_a_m_e_s': inherited from class '"Matrix"'

     '_f_a_c_t_o_r_s': Object of class '"list"'.  A named list of
          factorizations that have been computed for the matrix.

     '_s_d': (for '"corMatrix"') a 'numeric' vector of length 'n'
          containing the (original) sqrt(var(.)) entries which allow
          reconstruction of a covariance matrix from the correlation
          matrix.

_E_x_t_e_n_d_s:

     Class '"dsyMatrix"', directly.
      Classes '"dgeMatrix"', '"symmetricMatrix"', and many more by
     class '"dsyMatrix"'.

_M_e_t_h_o_d_s:


     _c_h_o_l 'signature(x = "dpoMatrix")': Returns (and stores) the
          Cholesky decomposition of 'x', see 'chol'.

     _r_c_o_n_d 'signature(x = "dpoMatrix", norm = "character")': Returns
          (and stores) the reciprocal of the condition number of 'x'. 
          The 'norm' can be '"O"' for the one-norm (the default) or
          '"I"' for the infinity-norm.  For symmetric matrices the
          result does not depend on the norm.

     _s_o_l_v_e 'signature(a = "dpoMatrix", b = "missing")': Return the
          inverse of 'a'.

     _s_o_l_v_e 'signature(a = "dpoMatrix", b = "numeric")': Solve the
          linear system defined by 'a' and 'b', where 'b' can be a
          numeric vector, or a matrix, or a dgeMatrix object.  The
          Cholesky decomposition of 'a' is calculated (if needed) while
          solving the system.

_S_e_e _A_l_s_o:

     Classes 'dsyMatrix' and 'dgeMatrix'; further, 'Matrix', 'rcond',
     'chol', 'solve', 'crossprod'.

_E_x_a_m_p_l_e_s:

     h6 <- Hilbert(6)
     rcond(h6)
     str(h6)
     solve(h6)
     str(hp6 <- as(h6, "dppMatrix"))

     ### Note that  as(*, "corMatrix")  *scales* the matrix
     (ch6 <- as(h6, "corMatrix"))
     stopifnot(all.equal(ch6@sd^(-2), 2*(1:6)-1, tol= 1e-12))
     chch <- chol(ch6)
     stopifnot(identical(chch, ch6@factors$Cholesky),
               all(abs(crossprod(chch) - ch6) < 1e-10))

