Learn R Programming

rTensor (version 1.4.9)

Tools for Tensor Analysis and Decomposition

Description

A set of tools for creation, manipulation, and modeling of tensors with arbitrary number of modes. A tensor in the context of data analysis is a multidimensional array. rTensor does this by providing a S4 class 'Tensor' that wraps around the base 'array' class. rTensor provides common tensor operations as methods, including matrix unfolding, summing/averaging across modes, calculating the Frobenius norm, and taking the inner product between two tensors. Familiar array operations are overloaded, such as index subsetting via '[' and element-wise operations. rTensor also implements various tensor decomposition, including CP, GLRAM, MPCA, PVD, and Tucker. For tensors with 3 modes, rTensor also implements transpose, t-product, and t-SVD, as defined in Kilmer et al. (2013). Some auxiliary functions include the Khatri-Rao product, Kronecker product, and the Hadamard product for a list of matrices.

Copy Link

Version

Install

install.packages('rTensor')

Monthly Downloads

675

Version

1.4.9

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Koki Tsuyuzaki

Last Published

August 25th, 2025

Functions in rTensor (1.4.9)

modeMean-methods

Tensor Mean Across Single Mode
modeSum-methods

Tensor Sum Across Single Mode
t_svd

Tensor Singular Value Decomposition
rTensor-package

Tools for tensor analysis and decomposition
t_mult

Tensor Multiplication (T-MULT)
rand_tensor

Tensor with Random Entries
tperm-methods

Mode Permutation for Tensor
ttl

Tensor Times List
print-methods

Print for Tensor
vec-methods

Tensor Vec
pvd

Population Value Decomposition
rs_fold

Row Space Folding of Matrix
matvec-methods

Tensor Matvec Unfolding
load_orl

ORL Database of Faces
rs_unfold-methods

Tensor Row Space Unfolding
tail-methods

Tail for Tensor
tucker

Tucker Decomposition
t_svd_reconstruct

Reconstruct Tensor From TSVD
ttm

Tensor Times Matrix (m-Mode Product)
mpca

Multilinear Principal Components Analysis
head-methods

Head for Tensor
plot_orl

Function to plot the ORL Database of Faces
show-methods

Show for Tensor
t-methods

Tensor Transpose
unmatvec

Unmatvec Folding of Matrix
unfold-methods

Tensor Unfolding
as.tensor

Tensor Conversion
[-methods

Extract or Replace Subtensors
dim-methods

Mode Getter for Tensor
fold

General Folding of Matrix
Ops-methods

Conformable elementwise operators for Tensor
fnorm-methods

Tensor Frobenius Norm
Tensor-class

S4 Class for a Tensor
cs_fold

Column Space Folding of Matrix
cp

Canonical Polyadic Decomposition
cs_unfold-methods

Tensor Column Space Unfolding
k_unfold-methods

Tensor k-mode Unfolding
hosvd

(Truncated-)Higher-order SVD
initialize-methods

Initializes a Tensor instance
k_fold

k-mode Folding of Matrix
innerProd-methods

Tensors Inner Product
hadamard_list

List hadamard Product
khatri_rao_list

List Khatri-Rao Product
kronecker_list

List Kronecker Product
khatri_rao

Khatri-Rao Product