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

# indexset -- get the list of index tuples of a tensor

- Usage:
    `indexset T`
- Inputs:
  - T, an instance of the type Tensor, A tensor whose index set is to be retrieved.
- Outputs:
  - a list, A list of index tuples corresponding to the entries of the tensor.

## Description

Given a tensor $T$ of format $\{d_1, d_2, \dots, d_n\}$, this method returns a list of all index tuples $(i_1, i_2, \dots, i_n)$ such that $0 \leq i_j < d_j$ for each dimension $j$. Difference from enumerateTensorIndices is that indexset can only be used with a Tensor object. indexset retrieves precomputed indices stored as metadata in a Tensor.

    i1 : T = zeroTensor(QQ, {2,3,4});

    i2 : indexset T

    o2 = {{0, 0, 0}, {0, 0, 1}, {0, 0, 2}, {0, 0, 3}, {0, 1, 0}, {0, 1, 1}, {0,
         ------------------------------------------------------------------------
         1, 2}, {0, 1, 3}, {0, 2, 0}, {0, 2, 1}, {0, 2, 2}, {0, 2, 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}, {1, 2, 0}, {1, 2, 1}, {1, 2, 2}, {1, 2, 3}}

    o2 : List

    i3 : T = zeroTensor(QQ, {2});

    i4 : indexset T

    o4 = {{0}, {1}}

    o4 : List

## See also

- zeroTensor -- construct a tensor with zero entries from a given ring.
- randomTensor -- construct a tensor with random entries from a given ring
- enumerateTensorIndices -- generate index tuples for a tensor with given dimensions

## Ways to use indexset:

- `indexset(Tensor)`

## For the programmer

The object indexset is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/GameTheory.m2:1023:0.