simple_triplet_matrix          package:slam          R Documentation

_S_i_m_p_l_e _T_r_i_p_l_e_t _M_a_t_r_i_x

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

     Data structures and operators for sparse matrices based on simple
     triplet representation.

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

     simple_triplet_matrix(i, j, v, nrow = max(i), ncol = max(j), dimnames = NULL)
     simple_triplet_zero_matrix(nrow, ncol = nrow, mode = "double")
     simple_triplet_diag_matrix(v, nrow = length(v))

     as.simple_triplet_matrix(x)
     is.simple_triplet_matrix(x)

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

    i, j: Integer vectors of row and column indices, respectively.

       v: Vector of values.

nrow, ncol: Integer values specifying the number of rows and columns,
          respectively. Defaults are the maximum row and column
          indices, respectively.

dimnames: A 'dimnames' attribute for the matrix: 'NULL' or a 'list' of
          length 2 giving the row and column names respectively.  An
          empty list is treated as 'NULL', and a list of length one as
          row names.  The list can be named, and the list names will be
          used as names for the dimensions.

    mode: Character string specifying the mode of the values.

       x: An R object.

_D_e_t_a_i_l_s:

     'simple_triplet_matrix' is a generator for a class of
     lightweight sparse matrices, simply represented by triplets
     '(i, j, v)' of row indices 'i', column indices 'j', and values
     'v', respectively. 'simple_triplet_zero_matrix' and
     'simple_triplet_diag_matrix' are convenience functions for the
     creation of empty and diagonal matrices.

     Currently implemented operations include the addition,
     subtraction, multiplication and division of compatible simple
     triplet matrices, as well as the multiplication and division of a
     simple triplet matrix and a vector.  Comparisons of the elements
     of a simple triplet matrices with a number are also provided. In
     addition,  methods for indexing, combining by rows ('rbind') and
     columns ('cbind'), transposing ('t'), concatenating ('c'), and
     detecting/extracting duplicated and unique rows are implemented.

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

     'simple_sparse_array' for sparse arrays.

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

     x <- matrix(c(1, 0, 0, 2), nrow = 2)
     s <- as.simple_triplet_matrix(x)
     identical(x, as.matrix(s))

     simple_triplet_matrix(c(1, 4), c(1, 2), c(1, 2))
     simple_triplet_zero_matrix(3)
     simple_triplet_diag_matrix(1:3)

     cbind(rbind(x, t(x)), rbind(x, x))

