Diagonal               package:Matrix               R Documentation

_C_r_e_a_t_e _D_i_a_g_o_n_a_l _M_a_t_r_i_x _O_b_j_e_c_t

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

     Create a diagonal matrix object, i.e., an object inheriting from
     'diagonalMatrix'.

_U_s_a_g_e:

     Diagonal(n, x = NULL)

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

       n: integer specifying the dimension of the (square) matrix.  If
          missing, 'length(x)' is used.

       x: numeric or logical; if missing, a _unit_ diagonal n x n
          matrix is created.

_V_a_l_u_e:

     an object of class 'ddiMatrix' or 'ldiMatrix' (with "superclass"
     'diagonalMatrix').

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

     the generic function 'diag' for _extraction_ of the diagonal from
     a matrix works for all "Matrices". 'Matrix', class
     'diagonalMatrix'.

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

     Diagonal(3)
     Diagonal(x = 10^(3:1))
     Diagonal(x = (1:4) >= 2)#-> "ldiMatrix"

     ## Use Diagonal() + kronecker() for "repeated-block" matrices:
     M1 <- Matrix(0+0:5, 2,3)
     (M <- kronecker(Diagonal(3), M1))

