Macaulay2 » Documentation
Packages » GameTheory :: enumerateTensorIndices
next | previous | forward | backward | up | index | toc

enumerateTensorIndices -- generate index tuples for a tensor with given dimensions

Description

This function generates all possible index tuples for a tensor with the specified dimensions. For a tensor of format $d_1 \times d_2 \cdots d_n$, it returns a list of all tuples $(i_1, i2, \ldots, i_n)$ where $0 \leq i_j < d_j$.

i1 : enumerateTensorIndices 5

o1 = {{0}, {1}, {2}, {3}, {4}}

o1 : List
i2 : enumerateTensorIndices {2,2}

o2 = {{0, 0}, {0, 1}, {1, 0}, {1, 1}}

o2 : List
i3 : enumerateTensorIndices {3,2,4}

o3 = {{0, 0, 0}, {0, 0, 1}, {0, 0, 2}, {0, 0, 3}, {0, 1, 0}, {0, 1, 1}, {0,
     ------------------------------------------------------------------------
     1, 2}, {0, 1, 3}, {1, 0, 0}, {1, 0, 1}, {1, 0, 2}, {1, 0, 3}, {1, 1, 0},
     ------------------------------------------------------------------------
     {1, 1, 1}, {1, 1, 2}, {1, 1, 3}, {2, 0, 0}, {2, 0, 1}, {2, 0, 2}, {2, 0,
     ------------------------------------------------------------------------
     3}, {2, 1, 0}, {2, 1, 1}, {2, 1, 2}, {2, 1, 3}}

o3 : List

See also

Ways to use enumerateTensorIndices:

  • enumerateTensorIndices(List)
  • enumerateTensorIndices(ZZ)

For the programmer

The object enumerateTensorIndices is a method function.


The source of this document is in /build/reproducible-path/macaulay2-1.25.06+ds/M2/Macaulay2/packages/GameTheory.m2:953:0.