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)

