dtCMatrix-class            package:Matrix            R Documentation

_T_r_i_a_n_g_u_l_a_r, (_c_o_m_p_r_e_s_s_e_d) _s_p_a_r_s_e _c_o_l_u_m_n _m_a_t_r_i_c_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     The '"dtCMatrix"' class is a class of triangular, sparse matrices
     in the compressed, column-oriented format.  In this implementation
     the non-zero elements in the columns are sorted into increasing
     row order.  The '"dtTMatrix"' class is a class of triangular,
     sparse matrices in triplet format.

_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("dtCMatrix",
     ...)' or calls of the form  'new("dtTMatrix", ...)', but more
     typically automatically via 'Matrix()' or coercion such as 'as(x,
     "dtCMatrix")'.

_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.

     '_d_i_a_g': Object of class '"character"'. Must be either '"U"', for
          unit triangular (diagonal is all ones), or '"N"'; see
          'triangularMatrix'.

     '_p': Object of class '"integer"' of pointers, one for each column,
          to the initial (zero-based) index of elements in the column.
          (Only present in the 'dtCMatrix' class.)

     '_i': Object of class '"integer"' of length nnzero (number of
          non-zero elements).  These are the row numbers for each
          non-zero element in the matrix.

     '_j': Object of class '"integer"' of length nnzero (number of
          non-zero elements).  These are the column numbers for each
          non-zero element in the matrix. (Only present in the
          'dtTMatrix' class.)

     '_x': Object of class '"numeric"' - the non-zero elements of the
          matrix.

     '_D_i_m','_D_i_m_n_a_m_e_s': The dimension (a length-2 '"integer"') and
          corresponding names (or 'NULL'), inherited from the 'Matrix',
          see there.

_E_x_t_e_n_d_s:

     Class '"dgCMatrix"', directly. Class '"triangularMatrix"',
     directly. Class '"dMatrix"', '"sparseMatrix"', and more by class
     '"dgCMatrix"' etc, see the examples.

_M_e_t_h_o_d_s:


     _c_o_e_r_c_e 'signature(from = "dtCMatrix", to = "dgTMatrix")'

     _c_o_e_r_c_e 'signature(from = "dtCMatrix", to = "dgeMatrix")'

     _c_o_e_r_c_e 'signature(from = "dtTMatrix", to = "dgeMatrix")'

     _c_o_e_r_c_e 'signature(from = "dtTMatrix", to = "dtrMatrix")'

     _c_o_e_r_c_e 'signature(from = "dtTMatrix", to = "matrix")'

     _s_o_l_v_e 'signature(a = "dtCMatrix", b = "matrix")'

     _s_o_l_v_e 'signature(a = "dtCMatrix", b = "dgeMatrix")'

     _s_o_l_v_e 'signature(a = "dtCMatrix", b = "missing")'

     _s_o_l_v_e 'signature(a = "dtCMatrix", b = "numeric")'

     _s_o_l_v_e 'signature(a = "dtCMatrix", b = "CsparseMatrix")': fully
          sparse triangular solve, in traditional S/R aka 'backsolve'.

     _t 'signature(x = "dtCMatrix")': returns the transpose of 'x'

     _t 'signature(x = "dtTMatrix")': returns the transpose of 'x'

_S_e_e _A_l_s_o:

     Classes 'dgCMatrix', 'dgTMatrix', 'dgeMatrix', and 'dtrMatrix'.

_E_x_a_m_p_l_e_s:

     showClass("dtCMatrix")

     showClass("dtTMatrix")
     t1 <- new("dtTMatrix", x= c(3,7), i= 0:1, j=3:2, Dim= as.integer(c(4,4)))
     t1
     ## from  0-diagonal to unit-diagonal {low-level step}:
     tu <- t1 ; tu@diag <- "U"
     tu
     (cu <- as(tu, "dtCMatrix"))
     str(cu)# only two entries in @i and @x
     stopifnot(cu@i == 1:0,
               all(2 * symmpart(cu) == Diagonal(4) + forceSymmetric(cu)))

     t1[1,2:3] <- -1:-2
     diag(t1) <- 10*c(1:2,3:2)
     t1 # still triangular
     (it1 <- solve(t1))
     t1. <- solve(it1)
     all(abs(t1 - t1.) < 10 * .Machine$double.eps)

