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

