simple_sparse_array           package:slam           R Documentation

_S_i_m_p_l_e _S_p_a_r_s_e _A_r_r_a_y_s

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

     Data structures and operators for sparse arrays based on a
     representation by index matrix and value vector.

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

     simple_sparse_array(i, v, dim = NULL, dimnames = NULL)

     as.simple_sparse_array(x)
     is.simple_sparse_array(x)

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

       i: Integer matrix of array indices.

       v: Vector of values.

     dim: Integer vector specifying the size of the dimensions.

dimnames: either 'NULL' or the names for the dimensions. This is a list
          with one component for each dimension, either 'NULL' or a
          character vector of the length given by 'dim' for that
          dimension.  The list can be named, and the list names will be
          used as names for the dimensions.  If the list is shorter
          than the number of dimensions, it is extended by 'NULL''s to
          the length required.

       x: An R object.

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

     'simple_sparse_array' is a generator for a class of lightweight
     sparse arrays,  represented by index matrices and value vectors.
     Currently, only methods for indexing and coercion are implemented.

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

     'simple_sparse_array' for sparse arrays.

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

     x <- array(c(1, 0, 0, 2, 0, 0, 0, 3), dim = c(2, 2, 2))
     s <- as.simple_sparse_array(x)
     identical(x, as.array(s))

     simple_sparse_array(matrix(c(1, 1, 1, 3, 3, 3), nrow = 2), c(1, 2))

