rand_tensor: Tensor with Random Entries

Description Usage Arguments Value Note Examples

View source: R/rTensor_Misc.R

Description

Generate a Tensor with specified modes with iid normal(0,1) entries.

Usage

1
rand_tensor(modes = c(3, 4, 5), drop = FALSE)

Arguments

modes

the modes of the output Tensor

drop

whether or not modes equal to 1 should be dropped

Value

a Tensor object with modes given by modes

Note

Default rand_tensor() generates a 3-Tensor with modes c(3,4,5).

Examples

1
2
3

Example output

Numeric Tensor of 3 Modes
Modes:  3 4 5 
Data: 
[1]  0.06365444 -0.32348039  1.62945502 -0.33294478 -1.04150692 -0.14564043
Numeric Tensor of 3 Modes
Modes:  4 4 4 
Data: 
[1]  0.64781182 -0.12356294  0.53645622 -0.06455466  0.82366317 -0.12685799
Numeric Tensor of 2 Modes
Modes:  10 2 
Data: 
           [,1]         [,2]
[1,] -1.9208815 -0.623333518
[2,]  0.6749850  1.185485048
[3,]  0.7634139 -0.208146171
[4,]  0.6241862  0.004529606
[5,] -1.6123300  1.277260224
[6,] -0.9088903  0.377090614

rTensor documentation built on May 15, 2021, 9:06 a.m.