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.

     _A_r_i_t_h 'signature(e1 = "dpoMatrix", e2 = "numeric")' (and quite a
          few other signatures): The result of (elementwise defined)
          arithmetic operations is typically _not_ positive-definite
          anymore.  The only exceptions, currently, are
          multiplications, divisions or additions with _positive_
          'length(.) == 1' numbers (or 'logical's).

_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)
     h6 * 27720 # is ``integer''
     solve(h6)
     str(hp6 <- as(h6, "dppMatrix"))

     ### Note that  as(*, "corMatrix")  *scales* the matrix
     (ch6 <- as(h6, "corMatrix"))
     stopifnot(all.equal(h6 * 27720, round(27720 * h6), tol = 1e-14),
               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))

