knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
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:
The development version of tensorr is available on github.
devtools::install_github("zamorarr/tensorr")
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
Many of the dense and sparse implementation ideas were adpated from:
For a review on tensors, see:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.