names: Getting and setting index and dimensionnames of a tensor

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

Description

The names of a tensor are the names of its dimension

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## S3 method for class 'tensor'
names(x)
## S3 replacement method for class 'tensor'
names(x) <- value
## S3 method for class 'tensor'
dimnames(x) 
## S3 replacement method for class 'tensor'
dimnames(x) <- value
## S3 replacement method for class 'tensor'
dim(x) <- value

Arguments

x

a tensor object

value

The new value. If this is a named list it replaces the names of the dimensions. If its an unnamed list it gets the names of the dimensions.

Details

The names of the dimensions of the tensor are very relevant in any tensor arithmetic since they are the principle way to specify the dimensions to be involved in an operation. The dimnames function is here only for convenice to guarantee that the names of the dimnames are always the same as the names of the dimensions and to ensure that always at least a list with the right length and names.

Value

the names of the dimensions the tensor

Author(s)

K. Gerald van den Boogaart

See Also

mul.tensor

Examples

1
2
3
4
5
6
7
8
A <- to.tensor(1:20,c(U=2,V=2,W=5))
A
dim(A)
names(A)
names(A) <- c("A","B","C")
A
dim(A)
names(A)

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

Related to names in tensorA...