R中的多维稀疏数组(3路张量) [英] Multidimensional sparse array (3-way tensor) in R
问题描述
使用 Matrix
包,我可以创建一个二维稀疏矩阵.
Using the Matrix
package I can create a two-dimensional sparse matrix.
有人可以推荐一个可以让我在 R 中创建多维(特别是 3 维)稀疏矩阵(数组,或技术上的三向张量)的包吗?
Can someone suggest a package that would allow me to create a multidimensional (specifically a 3-dimensional) sparse matrix (array, or technically a three-way tensor) in R?
推荐答案
slam
包有一个 simple_sparse_array
类:http://finzi.psych.upenn.edu/R/library/slam/html/array.html ,虽然它只是支持索引和强制(如果你想做张量运算或元素算术,而不转换回常规的密集数组,你必须自己实现它们......)
The slam
package has a simple_sparse_array
class: http://finzi.psych.upenn.edu/R/library/slam/html/array.html , although it only has support for indexing and coercion (if you wanted to do tensor operations, or elementwise arithmetic, without converting back to a regular dense array, you'd have to implement them yourself ...)
我通过这样做找到了这个
I found this by doing
library("sos")
findFn("{sparse array}")
这篇关于R中的多维稀疏数组(3路张量)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!