postensor: enumeration of index combinations

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

Description

This gives all combinations of indices of a tensor with dimension d in the order of the numbers in the memory.

Usage

1

Arguments

d

a dim attribute of a tensor

Details

tensors are stored according to the R-convention that the leftmost index varies fastest.

Value

a matrix with the same number of rows as the tensor has entries an the same number of columns as the tensor has dimensions. Each row represents the index combination of a the corresponding element.

Author(s)

K.Gerald van den Boogaart

See Also

reorder.tensor

Examples

1
2
   (A <- to.tensor(1:20,dim=c(A=2,B=2,C=5)))
   pos.tensor(dim(A))

Example output

Attaching package: 'tensorA'

The following object is masked from 'package:base':

    norm

, , 1

      B
A      [,1] [,2]
  [1,]    1    3
  [2,]    2    4

, , 2

      B
A      [,1] [,2]
  [1,]    5    7
  [2,]    6    8

, , 3

      B
A      [,1] [,2]
  [1,]    9   11
  [2,]   10   12

, , 4

      B
A      [,1] [,2]
  [1,]   13   15
  [2,]   14   16

, , 5

      B
A      [,1] [,2]
  [1,]   17   19
  [2,]   18   20

attr(,"class")
[1] "tensor"
      A B C
 [1,] 1 1 1
 [2,] 2 1 1
 [3,] 1 2 1
 [4,] 2 2 1
 [5,] 1 1 2
 [6,] 2 1 2
 [7,] 1 2 2
 [8,] 2 2 2
 [9,] 1 1 3
[10,] 2 1 3
[11,] 1 2 3
[12,] 2 2 3
[13,] 1 1 4
[14,] 2 1 4
[15,] 1 2 4
[16,] 2 2 4
[17,] 1 1 5
[18,] 2 1 5
[19,] 1 2 5
[20,] 2 2 5

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

Related to postensor in tensorA...