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

zeroTensor -- construct a tensor with zero entries from a given ring.

Description

This method constructs a tensor with the specified format and fills it with zeros from the given ring. Internally, it uses a hash table where each key is a multi-index (a list of positions). Metadata such as the format, coefficient ring, and index set are stored in the tensor as well. It is useful for defining a custom tensor.

i1 : T = zeroTensor {2,2};
i2 : T#{0,0} = 1;
i3 : T#{0,1} = 2;
i4 : T#{1,0} = 3;
i5 : T#{1,1} = 4;
i6 : format T

o6 = {2, 2}

o6 : List
i7 : peek T

o7 = Tensor{{0, 0} => 1                                }
            {0, 1} => 2
            {1, 0} => 3
            {1, 1} => 4
            coefficients => QQ
            format => {2, 2}
            indexes => {{0, 0}, {0, 1}, {1, 0}, {1, 1}}

See also

Ways to use zeroTensor:

  • zeroTensor(List)
  • zeroTensor(Ring,List)

For the programmer

The object zeroTensor is a method function.


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