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

# slice -- extract a slice of a tensor

- Usage:
    `slice(T, Lstart, Lend)`
- Inputs:
  - T, an instance of the type Tensor, A tensor from which to extract the slice.
  - Lstart, a list, A list of fixed indices before the varying position.
  - Lend, a list, A list of fixed indices after the varying position.
- Outputs:
  - a list, A list of entries of the tensor along the specified dimension.

## Description

This method varies the index at the position given by the length of Lstart, iterating from 0 to $d_i - 1$, where $d_i$ is the corresponding index of the format.

The slice is formed by fixing all other indices and varying only the one at the slicing position.

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

    i2 : T#{0,0,0} = 5;

    i3 : T#{0,1,0} = 6;

    i4 : T#{0,2,0} = 7;

    i5 : slice(T, {0}, {0})

    o5 = {5, 6, 7}

    o5 : List

## See also

- enumerateTensorIndices -- generate index tuples for a tensor with given dimensions
- Tensor -- a mutable hash table representing a tensor

## Ways to use slice:

- `slice(Tensor,List,List)`

## For the programmer

The object slice is a method function.

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