as.tensor {rTensor2} | R Documentation |
Tensor Conversion
Description
Create a Tensor-class object from an array, matrix, or vector.
Usage
as.tensor(x, drop = FALSE)
Arguments
x |
: an instance of array, matrix, or vector |
drop |
: whether or not modes equal to 1 should be dropped |
Value
a Tensor-class object
Author(s)
Kyle Caudle
Randy Hoover
Jackson Cates
References
Imported from rTensor package version 1.4.8.
Examples
#From vector
vec <- runif(3); vecT <- as.tensor(vec); vecT
#From matrix
mat <- matrix(runif(2*3),nrow=2,ncol=3)
matT <- as.tensor(mat); matT
#From array
indices <- c(2,3,4)
arr <- array(runif(prod(indices)), dim = indices)
arrT <- as.tensor(arr); arrT
[Package rTensor2 version 2.0.0 Index]