Multidimensional sparse array (3-way tensor) in R

前端 未结 2 1271
终归单人心
终归单人心 2021-02-19 06:17

Using the Matrix package I can create a two-dimensional sparse matrix.

Can someone suggest a package that would allow me to create a multidimensional (speci

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-19 06:28

    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}")
    

提交回复
热议问题