Represents a tensor that is the sum of several parts (dense tensors,
Kruskal tensors, or Tucker tensors) without materializing the sum,
mirroring the MATLAB Tensor Toolbox sumtensor. Operations distribute
over the parts where a structured implementation exists.
Arguments
- ...
Tensor-like parts (or a single list of parts) with identical
dimensions.
Value
A SumTensor object.
Public fields
parts
List of tensor-like parts
Methods
SumTensor$new()
Initialize a new SumTensor
Arguments
parts
List of tensor-like objects with identical dimensions.
Returns
A new SumTensor object
SumTensor$dim()
Get dimensions of the tensor
Returns
Integer vector of dimensions
SumTensor$ndims()
Get number of dimensions
Returns
Integer tensor order
SumTensor$print()
Print the SumTensor object
SumTensor$full()
Convert to a dense Tensor by materializing the sum
SumTensor$clone()
The objects of this class are cloneable with this method.
Usage
SumTensor$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Examples
X <- tensor(array(rnorm(24), dim = c(2, 3, 4)))
K <- ktensor(1, list(matrix(1, 2), matrix(1, 3), matrix(1, 4)))
S <- sumtensor(X, K)