Sparse Tensors in R

Provides methods to manipulate and store sparse tensors. Tensors are multidimensional generalizations of matrices (two dimensional) and vectors (one dimensional).


CRAN_Status_Badge Build Status AppVeyor Build Status Coverage Status

tensorr provides methods to manipulate and store sparse tensors. Tensors are multi-dimensional generalizations of matrices (two dimensional) and vectors (one dimensional).

It has three main goals:

  • Provide an efficient format to store sparse tensors in R.
  • Provide standard tensor operations such as multiplication and unfolding.
  • Provide standard tensor decomposition techniques such as CP and Tucker.

Installation

The development version of tensorr is available on github.

devtools::install_github("zamorarr/tensorr")

Usage

See the introduction vignette for a comprehensive overview. To create a sparse tensor you have to provide the non-zero values, subscripts to the non-zero values, and the overall dimensions of the tensor.

library(tensorr)
 
subs <- list(c(1,1,1), c(1,1,2))
vals <- c(10, 20)
dims <- c(2,2,2)
x <- sptensor(subs, vals, dims)
x
#> subs: <1,1,1> <1,1,2>
#> vals: 10 20

Tensor References

Many of the dense and sparse implementation ideas were adpated from:

  • B. W. Bader and T. G. Kolda. Algorithm 862: MATLAB tensor classes for fast algorithm prototyping, ACM Transactions on Mathematical Software 32(4):635-653, December 2006.
  • B. W. Bader and T. G. Kolda. Efficient MATLAB computations with sparse and factored tensors, SIAM Journal on Scientific Computing 30(1):205-231, December 2007.
  • scikit-tensor

For a review on tensors, see:

  • T. G. Kolda and B. W. Bader, Tensor Decompositions and Applications, SIAM Review 51(3):455-500, September 2009

News

tensorr 0.1

  • Added initial sptensor and dtensor objects.
  • Implemented extract and replace operations for tensors.
  • Implemented conversion functions between dense and sparse formats.
  • Implemented group generics for tensors.
  • Implemented tesnsor operations such as unfolding and tensor multiplication.
  • Added a NEWS.md file to track changes to the package.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("tensorr")

0.1.1 by Robert Zamora, a month ago


https://github.com/zamorarr/tensorr


Report a bug at https://github.com/zamorarr/tensorr/issues


Browse source code at https://github.com/cran/tensorr


Authors: Robert Zamora [aut, cre]


Documentation:   PDF Manual  


GPL-3 license


Imports assertive.base, assertive.properties, assertive.types, Matrix, methods, purrr

Suggests covr, knitr, rmarkdown, testthat


See at CRAN