untensor: Removes indices/dimensions from a tensor

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/TensorAx.R

Description

untensor is more or less the inverse of to.tensor. It flattens tensorial dimensions. However the result is still a tensor.

Usage

1

Arguments

X

the tensor

i

the names of the dimensions to be removed and combined to a single new one as a character vector or a named list of character vectors if the remove should be done in multiple chunks. pos and name is in this case ignored.

name

the name of the new dimension to replace the others

pos

where to insert the the new dimension

by

if i not given the dimensions to be kept

Details

The dimensions to be removed are gathered and

Value

a tensor with the dimensions i removed.

Author(s)

K.Gerald van den Boogaart

See Also

to.tensor

Examples

1
2
3
4
A <- to.tensor(1:64,c(a=2,b=2,c=2,d=2,e=2,f=2))
untensor(A,list(c(1,5),c(2,4)),name=c("i","j"))
untensor(A,by=c("c","f"))
untensor(A,c("a","d"))

tensorA documentation built on Nov. 20, 2020, 9:07 a.m.

Related to untensor in tensorA...