View source: R/rTensor_Class.R
as.tensor | R Documentation |
Create a Tensor-class
object from an array
, matrix
, or vector
.
as.tensor(x, drop = FALSE)
x |
an instance of |
drop |
whether or not modes of 1 should be dropped |
a Tensor-class
object
#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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.