ddiMatrix-class            package:Matrix            R Documentation

_C_l_a_s_s "_d_d_i_M_a_t_r_i_x" _o_f _D_i_a_g_o_n_a_l _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 class '"ddiMatrix"' of numerical diagonal matrices. Note that
     diagonal matrices now extend _'sparseMatrix'_, whereas they did
     extend dense matrices earlier.

_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("ddiMatrix",
     ...)' but typically rather via 'Diagonal'.

_S_l_o_t_s:


     '_x': numeric vector.  For an n * n matrix, the 'x' slot is of
          length n or '0', depending on the 'diag' slot:

     '_d_i_a_g': '"character"' string, either '"U"' or '"N"' where '"U"'
          denotes unit-diagonal, i.e., identity matrices.

     '_D_i_m','_D_i_m_n_a_m_e_s': matrix dimension and 'dimnames', see the
          'Matrix' class description.

_E_x_t_e_n_d_s:

     Class '"diagonalMatrix"', directly. Class '"dMatrix"', directly.
     Class '"sparseMatrix"', indirectly, see 'showClass("ddiMatrix")'.

_M_e_t_h_o_d_s:


     %*% 'signature(x = "ddiMatrix", y = "ddiMatrix")': ... 

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

     Class 'diagonalMatrix' and function 'Diagonal'.

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

     (d2 <- Diagonal(x = c(10,1)))
     str(d2)
     ## slightly larger in internal size:
     str(as(d2, "sparseMatrix"))

     M <- Matrix(cbind(1,2:4))
     M %*% d2 #> `fast' multiplication

     chol(d2) # trivial
     stopifnot(is(cd2 <- chol(d2), "ddiMatrix"),
               all.equal(cd2@x, c(sqrt(10),1)))

