Description Usage Arguments Details Note See Also Examples

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

1 2 3 4 5 6 7 8 | ```
simple_sparse_array(i, v, dim = NULL, dimnames = NULL)
as.simple_sparse_array(x)
is.simple_sparse_array(x)
simplify_simple_sparse_array(x, higher = TRUE)
reduce_simple_sparse_array(x, strict = FALSE, order = FALSE)
drop_simple_sparse_array(x)
``` |

`i` |
Integer matrix of array indices. |

`v` |
Vector of values. |

`dim` |
Integer vector specifying the size of the dimensions. |

`dimnames` |
either |

`x` |
An |

`higher` |
Option to use the dimensions of the values (see Note). |

`strict` |
Option to treat violations of sparse representation as error (see Note). |

`order` |
Option to reorder elements (see Note). |

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

The *zero* element is defined as `vector(typeof(v), 1L)`

,
for example, `FALSE`

for `logical`

values (see
`vector`

). Clearly, sparse arrays should not contain
*zero* elements, however, for performance reasons the class
generator does not remove them.

If `strict = FALSE`

(default) `reduce_simple_sparse_array`

tries
to repair violations of sparse representation (*zero, multiple*
elements), otherwise it stops. If `order = TRUE`

the elements are
further reordered (see `array`

).

`simplify_simple_sparse_array`

tries to reduce `v`

. If
`higher = TRUE`

(default) augments `x`

by the common dimensions
of `v`

(from the left), or the common length. Note that *scalar*
elements are never extended and unused dimensions never dropped.

`drop_simple_sparse_array`

drops unused dimensions.

If `prod(dim(x)) > slam_options("max_dense")`

empty and negative
indexing are disabled
for `[`

and `[<-`

. Further, non-negative single (vector)
indexing is limited to 52 bits of representation.

`simple_triplet_matrix`

for sparse matrices.

`slam_options`

for options.

1 2 3 4 5 |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.