as.tensor: Tensor Conversion

Description Usage Arguments Value Examples

View source: R/rTensor_Class.R

Description

Create a Tensor-class object from an array, matrix, or vector.

Usage

1

Arguments

x

an instance of array, matrix, or vector

drop

whether or not modes of 1 should be dropped

Value

a Tensor-class object

Examples

1
2
3
4
5
6
7
8
9
#From vector
vec <- runif(100); vecT <- as.tensor(vec); vecT
#From matrix
mat <- matrix(runif(1000),nrow=100,ncol=10)
matT <- as.tensor(mat); matT
#From array
indices <- c(10,20,30,40)
arr <- array(runif(prod(indices)), dim = indices)
arrT <- as.tensor(arr); arrT

jamesyili/rTensor documentation built on May 18, 2019, 11:22 a.m.