Tensor Spaces

In Magma a tensor space is a parent type for tensors. It behaves as a module but also maintains an interpretation of its elements as multilinear maps. Each tensor space further maintains a tensor category which is assigned to its tensors.

Constructions of Tensor and Cotensor Spaces

Universal Tensor Spaces

Construction of universal tensor spaces is modeled after construction of free modules and matrix spaces. For efficiency reasons, the actual representation may vary based on the parameters, e.g. it may be a space of structure constants, black-box functions, or systems of forms. So access to the tensors in these tensor space should be made through the provided functions.

KTensorSpace(K, S): Fld, [RngIntElt] -> TenSpc
KTensorSpace(K, S, C): Fld, [RngIntElt], TenCat -> TenSpc

For a field \(K\) and sequence \(S=[d_{\nu},\cdots, d_0]\), returns the universal tensor space \(\oslash_{a\in [\nu]} K^{d_a}\) with covariant tensor category given by \(C\). The default category is the homotopism category.

RTensorSpace(R, S): Rng, [RngIntElt] -> TenSpc
RTensorSpace(R, S, C): Rng, [RngIntElt], TenCat -> TenSpc

For a commutative ring \(R\) and sequence \(S=[d_{\nu},\cdots, d_0]\), returns the universal tensor space \(\oslash_{a\in [\nu]} R^{d_a}\) with covariant tensor category given by \(C\). The default category is the homotopism category.

Example: Universal Tensor Space over a Field (ex-9c4d34)

Run in calculator (opens in a new tab)

We demonstrate how to construct universal tensor spaces from a field \(K={\mathbb{Q}}\) and a sequence of nonnegative integers \([6,5,4,3]\). The resulting tensor space is isomorphic to the space of multilinear maps with frame

\[{\mathbb{Q}}^6\times {\mathbb{Q}}^5\times{\mathbb{Q}}^4\rightarrowtail{\mathbb{Q}}^3.\]
> K := Rationals();
> S := [6, 5, 4, 3];
> T := KTensorSpace(K, S);
> T;
Tensor space of dimension 360 over Rational Field with valence 4
U3 : Full Vector space of degree 6 over Rational Field
U2 : Full Vector space of degree 5 over Rational Field
U1 : Full Vector space of degree 4 over Rational Field
U0 : Full Vector space of degree 3 over Rational Field

Because tensor spaces act like modules, we can construct tensors in the same way we construct vectors.

> t := T![Random([-1, 0, 1]) : i in [1..Dimension(T)]];
> t;
Tensor of valence 4, U3 x U2 x U1 >-> U0
U3 : Full Vector space of degree 6 over Rational Field
U2 : Full Vector space of degree 5 over Rational Field
U1 : Full Vector space of degree 4 over Rational Field
U0 : Full Vector space of degree 3 over Rational Field
> Parent(t);
Tensor space of dimension 360 over Rational Field with valence 4
U3 : Full Vector space of degree 6 over Rational Field
U2 : Full Vector space of degree 5 over Rational Field
U1 : Full Vector space of degree 4 over Rational Field
U0 : Full Vector space of degree 3 over Rational Field

Run in calculator (opens in a new tab)

TensorSpace(S): SeqEnum -> TenSpc, List
TensorSpace(S): List -> TenSpc, List
TensorSpace(S, C): SeqEnum, TenCat -> TenSpc, List
TensorSpace(S, C): List, TenCat -> TenSpc, List

Given a sequence \(S=[U_{\nu},\dots, U_0]\) of \(R\)-modules returns a universal tensor space equivalent to \(\oslash_{a\in[\nu]} U_a\) with covariant tensor category given by \(C\) and a list of maps into the vector spaces in the frame. The default category is the homotopism category.

Example: Universal Tensor Space from Modules (ex-d8700c)

Run in calculator (opens in a new tab)

We will construct a similar tensor space as the previous example. However, the objects will be different, according to Magma.

> R := Integers();
> S := [* RMatrixSpace(R, 2, 3), RSpace(R, 5), RMatrixSpace(R, 2, 2),
>     RSpace(R, 3) *];
> T := TensorSpace(S);
> T;
Tensor space of dimension 360 over Integer Ring with valence 4
U3 : Full RSpace of degree 6 over Integer Ring
U2 : Full RSpace of degree 5 over Integer Ring
U1 : Full RSpace of degree 4 over Integer Ring
U0 : Full RSpace of degree 3 over Integer Ring

Even though the frame of \(T\) does not include matrix spaces, like with tensors, it can still evaluate matrices. For example, we evaluate \(T\) at \((0,0,0)\), which is the trivial subspace in \({\mathbb{Z}}^3\).

> x := < X!0 : X in S[1..3] >;
> x;
<
    [0 0 0]
    [0 0 0],

    (0 0 0 0 0),

    [0 0]
    [0 0]
>
> x @ T;
RSpace of degree 3, dimension 0 over Integer Ring
Generators:

Run in calculator (opens in a new tab)

TensorSpace(V, p, q): ModTupFld, RngIntElt, RngIntElt -> TenSpc
TensorSpace(K, d, p, q): Fld, RngIntElt, RngIntElt, RngIntElt -> TenSpc

Given a field \(K\) and a dimension \(d\) or a vector space \(V=K^d\) for which the first \(p\) indices are covariant and the last \(q\) indices are contravariant, returns the signatured \((p,q)\)-tensor space over \(V\). This is functionally equivalent to creating a universal tensor space from the sequence \([V,\dots,_p V, V^*,\dots,_q V^*, K]\) and the tensor category with arrows \([1,\dots,_p 1, -1,\dots,_q -1, 0]\) and duplicates \(\{\{p+q,\dots,1+q\},\{q,\dots,1\},\{0\}\}\). The valence of the returned tensor space will be \(p+q+1\).

Example: Signatured Tensor Space (ex-170743)

Run in calculator (opens in a new tab)

Here we simply demonstrate the nuances of the signatured tensor space constructor. We set \(V={\bf F}_{5}^4\), \(p=3\), and \(q=2\), and the tensor space we will construct will have frame

\[V\times V\times V \times V^* \times V^*\rightarrowtail{\bf F}_{5}.\]

Notice this is equivalent to the frame \(V\times V\times V\rightarrowtail V \times V\).

> K := GF(5);
> T := TensorSpace(K, 4, 3, 2);
> T;
Tensor space of dimension 1024 over GF(5) with valence 6
U5 : Full Vector space of degree 4 over GF(5)
U4 : Full Vector space of degree 4 over GF(5)
U3 : Full Vector space of degree 4 over GF(5)
U2 : Full Vector space of degree 4 over GF(5)
U1 : Full Vector space of degree 4 over GF(5)
U0 : Full Vector space of degree 1 over GF(5)
> S := KTensorSpace(K, [4, 4, 4, 4, 4, 1]);
> S;
Tensor space of dimension 1024 over GF(5) with valence 6
U5 : Full Vector space of degree 4 over GF(5)
U4 : Full Vector space of degree 4 over GF(5)
U3 : Full Vector space of degree 4 over GF(5)
U2 : Full Vector space of degree 4 over GF(5)
U1 : Full Vector space of degree 4 over GF(5)
U0 : Full Vector space of degree 1 over GF(5)

However, the subtleties of this construction lies in the tensor category. On the surface, the spaces \(T\) and \(S\) look the same, but probing the category reveals their differences.

> TensorCategory(S); // default category
Tensor category of valence 6 (->,->,->,->,->,->) ({ 1 },{ 2 },{ 0 },{ 3 },{ 4
},{ 5 })
> TensorCategory(T);
Tensor category of valence 6 (<-,<-,<-,->,->,==) ({ 0 },{ 3 .. 5 },{ 1 .. 2 })
> S eq T;
false

Run in calculator (opens in a new tab)

Universal Cotensor Spaces

Currently, we only consider cotensor spaces over fields.

KCotensorSpace(K, S): Fld, [RngIntElt] -> TenSpc
KCotensorSpace(K, S, C): Fld, [RngIntElt], TenCat -> TenSpc

For a field \(K\) and sequence \(S=[d_{\nu},\dots, d_1]\) returns the universal cotensor space \(\bigotimes_{a\in\bar{0}}K^{d_a}\) with the given contravariant tensor category \(C\). The default category is the homotopism category. Notice the sequence \(S\) indices do not include 0.

CotensorSpace(S): SeqEnum -> TenSpc
CotensorSpace(S): List -> TenSpc, List
CotensorSpace(S, C): SeqEnum, TenCat -> TenSpc
CotensorSpace(S, C): List, TenCat -> TenSpc, List

Given a sequence \(S=[U_{\nu},\dots, U_1]\) of \(K\)-vector spaces returns the universal tensor space equivalent to \(\bigotimes_{a\in\bar{0}}U_a\) with contravariant tensor category given by \(C\) and a list of maps into the vector spaces of the frame. The default category is the homotopism category. Notice the sequence \(S\) indices do not include 0.

Example: Universal Cotensor Spaces (ex-a0d0fa)

Run in calculator (opens in a new tab)

Constructing cotensor spaces is nearly the same as constructing tensor spaces. When providing a sequence of modules or a sequence of dimensions, we do not include the entry for \(U_0\). It is automatically set to \(U_0=K\). Furthermore, the black-box construction forgets all other structure of the vector spaces and only builds a frame out of vector spaces. The maps are returned as a List in case they are needed.

> K := Rationals();
> S := [* KSpace(K, 3), MatrixAlgebra(K, 3), KMatrixSpace(K, 2, 3) *];
> S;
[*
    Full Vector space of degree 3 over Rational Field,
    Full Matrix Algebra of degree 3 over Rational Field,
    Full KMatrixSpace of 2 by 3 matrices over Rational Field
*]
> T := CotensorSpace(S);
> T;
Cotensor space of dimension 162 over Rational Field with valence 4
U3 : Full Vector space of degree 3 over Rational Field
U2 : Full Vector space of degree 9 over Rational Field
U1 : Full Vector space of degree 6 over Rational Field

Like with tensor spaces, cotensors are elements of cotensor spaces, and for many purposes in Magma, cotensor and tensor spaces have similar functionality.

> t := T.3;
> t;
Cotensor of valence 4, U3 x U2 x U1 >-> K
U3 : Full Vector space of degree 3 over Rational Field
U2 : Full Vector space of degree 9 over Rational Field
U1 : Full Vector space of degree 6 over Rational Field
> Eltseq(t);
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0 ]

Run in calculator (opens in a new tab)

Some Standard Constructions

We include some subspaces generated by well-known tensors.

AlternatingSpace(T): TenSpc -> TenSpc, Map

Returns the sub(co-)tensor space generated by all the alternating (co-)tensors contained in the given (co-)tensor space.

AntisymmetricSpace(T): TenSpc -> TenSpc, Map

Returns the sub(co-)tensor space generated by all the antisymmetric (co-)tensors contained in the given (co-)tensor space.

SymmetricSpace(T): TenSpc -> TenSpc, Map

Returns the sub(co-)tensor space generated by all the symmetric (co-)tensors contained in the given (co-)tensor space.

Example: Standard Tensor Subspaces (ex-4fe5c3)

Run in calculator (opens in a new tab)

We will construct some standard tensor subspaces of the universal tensor space with frame \({\bf F}_{3}^4\times {\bf F}_{3}^4\rightarrowtail{\bf F}_{3}^4\).

> K := GF(3);
> T := KTensorSpace(K, [4, 4, 4]);
> T;
Tensor space of dimension 64 over GF(5) with valence 3
U2 : Full Vector space of degree 4 over GF(5)
U1 : Full Vector space of degree 4 over GF(5)
U0 : Full Vector space of degree 4 over GF(5)

First, we will construct the subspace of \(T\) containing all alternating bilinear maps. We expect the subspace to be 24-dimensional in \(T\).

> Alt := AlternatingSpace(T);
> Alt;
Tensor space of dimension 24 over GF(3) with valence 3
U2 : Full Vector space of degree 4 over GF(3)
U1 : Full Vector space of degree 4 over GF(3)
U0 : Full Vector space of degree 4 over GF(3)
> t := Random(Alt);
> t;
Tensor of valence 3, U2 x U1 >-> U0
U2 : Full Vector space of degree 4 over GF(3)
U1 : Full Vector space of degree 4 over GF(3)
U0 : Full Vector space of degree 4 over GF(3)
> IsAlternating(t);
true

Now we will construct the symmetric subspace of the alternating subspace, which is trivial.

> S := SymmetricSpace(Alt);
> S;
Tensor space of dimension 0 over GF(3) with valence 3
U2 : Full Vector space of degree 4 over GF(3)
U1 : Full Vector space of degree 4 over GF(3)
U0 : Full Vector space of degree 4 over GF(3)

Run in calculator (opens in a new tab)

ExteriorCotensorSpace(V, n): ModTupFld, RngIntElt -> TenSpc

Returns the cotensor space given by the \(n\)th exterior power of the vector space \(V\).

SymmetricCotensorSpace(V, n): ModTupFld, RngIntElt -> TenSpc

Returns the cotensor space given by the \(n\)th symmetric power of the vector space \(V\).

Example: Standard Cotensor Subspaces (ex-cd38a4)

Run in calculator (opens in a new tab)

We set \(V={\bf F}_{5}^6\) and we construct the cotensor space of the symmetric square of \(V\), \(V\wedge V\). The frame is \(V\times V\rightarrowtail {\bf F}_{5}\), so the cotensor space is \(15\)-dimensional.

> V := VectorSpace(GF(5), 6);
> T := ExteriorCotensorSpace(V, 2);
> T;
Cotensor space of dimension 15 over GF(5) with valence 3
U2 : Full Vector space of degree 6 over GF(5)
U1 : Full Vector space of degree 6 over GF(5)

The cotensor space \(T\) is generated by all alternating tensors \(\langle t| : V\times V\rightarrowtail {\bf F}_{5}\). We will demonstrate by constructing a random cotensor from \(T\).

> t := Random(T);
> t;
Cotensor of valence 3, U2 x U1 >-> K
U2 : Full Vector space of degree 6 over GF(5)
U1 : Full Vector space of degree 6 over GF(5)
> SystemOfForms(t);
[
    [0 2 2 2 4 1]
    [3 0 4 1 0 0]
    [3 1 0 3 1 1]
    [3 4 2 0 2 0]
    [1 0 4 3 0 2]
    [4 0 4 0 3 0]
]
> IsAlternating(t);
true

Notice this construction is not \(V\times V\rightarrowtail V\wedge V\). However, if we want this tensor, we can use the intrinsic AsTensor.

> s := AsTensor(T);
> s;
Tensor of valence 3, U2 x U1 >-> U0
U2 : Full Vector space of degree 6 over GF(5)
U1 : Full Vector space of degree 6 over GF(5)
U0 : Full Vector space of degree 15 over GF(5)
> IsAlternating(s);
true

Run in calculator (opens in a new tab)

Operations on Tensor Spaces

Membership and Comparison with Tensor Spaces

We define some intuitive functions for tensor spaces, similar to those found for modules.

T in TS: TenSpcElt, TenSpc -> BoolElt

Returns true if \(T\) is contained in the tensor space \(TS\).

TS ! T: TenSpc, TenSpcElt -> TenSpcElt

If the tensor \(T\) can be coerced into the tensor space \(TS\), the tensor is returned as an element of \(TS\).

TS ! S: TenSpc, SeqEnum -> TenSpcElt

If the sequence \(S\) can be coerced into the tensor space \(TS\) as a tensor, the corresponding tensor is returned.

T ! n: TenSpc, RngIntElt -> TenSpcElt

This is a shortcut designed to only work when \(n=0\), and thus, returns true and the zero tensor from the tensor space. Any other integer will yield an error.

IsCoercible(TS, x): TenSpc, Any -> BoolElt, TenSpcElt

Returns true if \(x\) can be coerced into the tensor space \(TS\) and the corresponding tensor, otherwise false.

Example: Coercion into a Tensor Space (ex-e939dc)

Run in calculator (opens in a new tab)

We illustrate that using ! is the same as creating the tensor from scratch.

> T := KTensorSpace( GF(2), [2,3,2] );
> T;
Tensor space of dimension 12 over GF(2) with valence 3
U2 : Full Vector space of degree 2 over GF(2)
U1 : Full Vector space of degree 3 over GF(2)
U0 : Full Vector space of degree 2 over GF(2)
>
> S := [ 1 : i in [1..12] ];
> t := T!S;
> t;
Tensor of valence 3, U2 x U1 >-> U0
U2 : Full Vector space of degree 2 over GF(2)
U1 : Full Vector space of degree 3 over GF(2)
U0 : Full Vector space of degree 2 over GF(2)
>
> t eq Tensor(GF(2), [2,3,2], S);
true
>
> T!0 in T;
true
> SystemOfForms(T!0);
[
    [0 0 0]
    [0 0 0],

    [0 0 0]
    [0 0 0]
]

Run in calculator (opens in a new tab)

S eq T: TenSpc, TenSpc -> BoolElt

Decides if the tensor spaces \(S\) and \(T\) are equal.

S subset T: TenSpc, TenSpc -> BoolElt

Decides if \(S\) is a subset of the tensor space \(T\).

IsCoercible(T, S): TenSpc, Any -> BoolElt
T ! S: TenSpc, TenSpc -> TenSpc

Decides if the tensor space \(S\) can be coerced into the tensor space \(T\) as a subspace. If so, the corresponding subspace is returned.

Example: Containment of Tensor Spaces (ex-812352)

Run in calculator (opens in a new tab)

We construct the universal tensor space \(T\) with the frame \({\bf F}_{2}^4\times {\bf F}_{2}^4\rightarrowtail {\bf F}_{2}^4\). We also create a tensor space \(T_2\) with frame \({\bf F}_{2}^4\times {\bf F}_{2}\times {\bf F}_{2}^4\times{\bf F}_{2}\rightarrowtail {\bf F}_{2}^4\).

> T := KTensorSpace(GF(2), [4,4,4]);
> T;
Tensor space of dimension 64 over GF(2) with valence 3
U2 : Full Vector space of degree 4 over GF(2)
U1 : Full Vector space of degree 4 over GF(2)
U0 : Full Vector space of degree 4 over GF(2)
>
> T2 := KTensorSpace(GF(2), [4,1,4,1,4]);
> T2;
Tensor space of dimension 64 over GF(2) with valence 5
U4 : Full Vector space of degree 4 over GF(2)
U3 : Full Vector space of degree 1 over GF(2)
U2 : Full Vector space of degree 4 over GF(2)
U1 : Full Vector space of degree 1 over GF(2)
U0 : Full Vector space of degree 4 over GF(2)
>
> S := sub< T | T.2, T.4, T.8 >;
> S;
Tensor space of dimension 3 over GF(2) with valence 3
U2 : Full Vector space of degree 4 over GF(2)
U1 : Full Vector space of degree 4 over GF(2)
U0 : Full Vector space of degree 4 over GF(2)

We verify that \(S\) is a subset of \(T\) and not \(T_2\). Since the tensors of \(T\) naturally embed into \(T_2\), the subspace \(S\) can be coerced into \(T_2\), which we label as \(S_2\). We then verify that \(S_2\) is a subset of \(T_2\) and not \(T\).

> S subset T2;
false
> S2 := T2!S;
> S2 subset T2;
true
> S2 subset T;
false

Run in calculator (opens in a new tab)

Tensor Spaces as Modules

We view a tensor space as a \(K\)-module, so we have notions of generators, dimension (if it is free), and cardinality.

Basis(T): TenSpc -> SeqEnum
Generators(T): TenSpc -> SeqEnum

Returns a basis for the tensor space \(T\).

T . i: TenSpc, RngIntElt -> TenSpcElt

Returns the \(i\)th basis tensor of the tensor space \(T\).

NumberOfGenerators(T): TenSpc -> RngIntElt
Ngens(T): TenSpc -> RngIntElt

Returns the number of generators of the tensor space \(T\).

Dimension(T): TenSpc -> RngIntElt

Returns the dimension of the tensor space \(T\) as a free \(K\)-module.

# T: TenSpc -> RngIntElt

Returns the size of the tensor space, provided \(T\) is finite.

Example: Module Functions on Tensor Spaces (ex-d57848)

Run in calculator (opens in a new tab)

We demonstrate the basic module functions of tensor spaces. We construct the universal tensor space \(T\) with frame \({\bf F}_{8}^3\times{\bf F}_{8}^5\rightarrowtail{\bf F}_{8}^7\).

> K := GF(8);
> T := KTensorSpace(K, [3,5,7]);
> T;
Tensor space of dimension 105 over GF(2^3) with valence 3
U2 : Full Vector space of degree 3 over GF(2^3)
U1 : Full Vector space of degree 5 over GF(2^3)
U0 : Full Vector space of degree 7 over GF(2^3)

Now we obtain module properties of \(T\).

> Dimension(T);
105
> #Basis(T);
105
> T.100 in Basis(T);
true
> T.100;
Tensor of valence 3, U2 x U1 >-> U0
U2 : Full Vector space of degree 3 over GF(2^3)
U1 : Full Vector space of degree 5 over GF(2^3)
U0 : Full Vector space of degree 7 over GF(2^3)
> #T eq 8^(3*5*7);
true

Run in calculator (opens in a new tab)

Random(T): TenSpc -> TenSpcElt

Provided the base ring has a random algorithm in Magma, it returns a random element of the tensor space \(T\).

RandomTensor(R, S): Rng, [RngIntElt] -> TenSpcElt
RandomTensor(R, S, C): Rng, [RngIntElt], TenCat -> TenSpcElt
RandomCotensor(K, S): Fld, [RngIntElt] -> TenSpcElt

Provided \(R\) has a random algorithm in Magma, it returns a random (co)tensor from the universal (co)tensor space \(\oslash_{s\in S} R^{s}\), with category \(C\). The default category is the homotopism category.

Example: Random Tensors (ex-377558)

Run in calculator (opens in a new tab)

We create some random tensors, which works similarly to RandomMatrix. There are two main ways to obtain a random tensor: from a given tensor space or from a ring and a dimension sequence (the universal tensor space). First we will construct the alternating tensor space of the universal tensor space with frame \({\bf F}_{3}^4\times{\bf F}_{3}^4\rightarrowtail {\bf F}_{3}^2\).

> T := KTensorSpace(GF(3), [4,4,2]);
> T;
Tensor space of dimension 32 over GF(3) with valence 3
U2 : Full Vector space of degree 4 over GF(3)
U1 : Full Vector space of degree 4 over GF(3)
U0 : Full Vector space of degree 2 over GF(3)
> S := AlternatingSpace(T);
> S;
Tensor space of dimension 12 over GF(3) with valence 3
U2 : Full Vector space of degree 4 over GF(3)
U1 : Full Vector space of degree 4 over GF(3)
U0 : Full Vector space of degree 2 over GF(3)

Now we construct a random alternating tensor from \(S\).

> t := Random(S);
> t;
Tensor of valence 3, U2 x U1 >-> U0
U2 : Full Vector space of degree 4 over GF(3)
U1 : Full Vector space of degree 4 over GF(3)
U0 : Full Vector space of degree 2 over GF(3)
> SystemOfForms(t);
[
    [0 2 0 0]
    [1 0 0 0]
    [0 0 0 2]
    [0 0 1 0],

    [0 2 1 0]
    [1 0 1 2]
    [2 2 0 1]
    [0 1 2 0]
]

Run in calculator (opens in a new tab)

RandomAlternatingTensor(R, d, n, c): Rng, RngIntElt, RngIntElt, RngIntElt -> TenSpcElt
RandomAlternatingTensor(R, S): Rng, [RngIntElt] -> TenSpcElt

Returns a random alternating tensor from the universal tensor space

\[\prod_{k=1}^n R^d \rightarrowtail R^c.\]

If \(S\) is given instead, then we assume \(S=[d,\dots,d,c]\). The returned tensor has the homotopism category but fuses every module in the domain. An error is raised if \(R\) does not have a random algorithm in Magma.

RandomAntisymmetricTensor(R, d, n, c): Rng, RngIntElt, RngIntElt, RngIntElt -> TenSpcElt
RandomAntisymmetricTensor(R, S): Rng, [RngIntElt] -> TenSpcElt

Returns a random antisymmetric tensor from the universal tensor space

\[\prod_{k=1}^n R^d \rightarrowtail R^c.\]

If \(S\) is given instead, then we assume \(S=[d,\dots,d,c]\). The returned tensor has the homotopism category but fuses every module in the domain. An error is raised if \(R\) does not have a random algorithm in Magma.

RandomSymmetricTensor(R, d, n, c): Rng, RngIntElt, RngIntElt, RngIntElt -> TenSpcElt
RandomSymmetricTensor(R, S): Rng, [RngIntElt] -> TenSpcElt

Returns a random symmetric tensor from the universal tensor space

\[\prod_{k=1}^n R^d \rightarrowtail R^c.\]

If \(S\) is given instead, then we assume \(S=[d,\dots,d,c]\). The returned tensor has the homotopism category but fuses every module in the domain. An error is raised if \(R\) does not have a random algorithm in Magma.

Example: Random Symmetric Tensors (ex-f99231)

Run in calculator (opens in a new tab)

We just demonstrate how to use the RandomSymmetricTensor. The other two intrinsics are the same. This is almost equivalent to constructing a random tensor whose category fuses all the modules in the domain and then applying SymmetricTensor. In characteristic 2, all entries on the diagonal will be 0, but with RandomSymmetricTensor this is not the case.

> t := RandomSymmetricTensor(GF(2), 4, 2, 3);
> t;
Tensor of valence 3, U2 x U1 >-> U0
U2 : Full Vector space of degree 4 over GF(2)
U1 : Full Vector space of degree 4 over GF(2)
U0 : Full Vector space of degree 3 over GF(2)
>
> TensorCategory(t);
Tensor category of valence 3 (->,->,->) ({ 0 },{ 1 .. 2 })
>
> SystemOfForms(t);
[
    [1 1 1 1]
    [1 0 1 0]
    [1 1 1 1]
    [1 0 1 0],

    [1 0 1 1]
    [0 0 1 0]
    [1 1 0 0]
    [1 0 0 1],

    [1 0 0 0]
    [0 0 1 1]
    [0 1 0 0]
    [0 1 0 1]
]
> IsSymmetric(t);
true

Run in calculator (opens in a new tab)

Properties of Tensor Spaces

We define some functions to access basic properties of tensor spaces.

Valence(T): TenSpc -> RngIntElt

Returns the valence of the tensor space.

Frame(T): TenSpc -> List

Returns the list of modules in the frame of the tensor space.

BaseRing(T): TenSpc -> Rng
BaseField(T): TenSpc -> Fld

Returns the base ring (or field) of the tensor space.

Example: Properties of Tensor Spaces (ex-40631c)

Run in calculator (opens in a new tab)

As with tensors, we can obtain the basic tensor properties from a tensor space.

> T := KTensorSpace(Rationals(), [7,5,3,2]);
> T;
Tensor space of dimension 210 over Rational Field with valence 4
U3 : Full Vector space of degree 7 over Rational Field
U2 : Full Vector space of degree 5 over Rational Field
U1 : Full Vector space of degree 3 over Rational Field
U0 : Full Vector space of degree 2 over Rational Field
> Valence(T);
4
> Frame(T);
[*
    Full Vector space of degree 7 over Rational Field,

    Full Vector space of degree 5 over Rational Field,

    Full Vector space of degree 3 over Rational Field,

    Full Vector space of degree 2 over Rational Field
*]
> BaseRing(T);
Rational Field

Run in calculator (opens in a new tab)

TensorCategory(T): TenSpc -> TenCat

Returns the underlying tensor category of the tensor space.

IsCovariant(T): TenSpc -> BoolElt
IsContravariant(T): TenSpc -> BoolElt

Decides if the underlying tensor category is covariant or contravariant.

ChangeTensorCategory(T, C): TenSpc, TenCat -> TenSpc
ChangeTensorCategory(~T, C): TenSpc, TenCat

Returns the tensor category with the given tensor category.

Example: Categories of Tensor Spaces (ex-066785)

Run in calculator (opens in a new tab)

Again, like with tensors, we can obtain categorical information from tensor spaces.

> T := KTensorSpace(Rationals(), [4,4,4]);
> T;
Tensor space of dimension 64 over Rational Field with valence 3
U2 : Full Vector space of degree 4 over Rational Field
U1 : Full Vector space of degree 4 over Rational Field
U0 : Full Vector space of degree 4 over Rational Field
>
> TensorCategory(T);
Tensor category of valence 3 (->,->,->) ({ 1 },{ 2 },{ 0 })
> C := TensorCategory([1,1,-1], {{0},{1,2}});
> C;
Tensor category of valence 3 (->,->,<-) ({ 0 },{ 1, 2 })
>
> ChangeTensorCategory(~T, C);
> T;
Tensor space of dimension 64 over Rational Field with valence 3
U2 : Full Vector space of degree 4 over Rational Field
U1 : Full Vector space of degree 4 over Rational Field
U0 : Full Vector space of degree 4 over Rational Field
> TensorCategory(T);
Tensor category of valence 3 (->,->,<-) ({ 0 },{ 1, 2 })

Run in calculator (opens in a new tab)

IsAlternating(T): TenSpc -> BoolElt

Decides if every tensor in the tensor space is an alternating tensor.

IsAntisymmetric(T): TenSpc -> BoolElt

Decides if every tensor in the tensor space is an antisymmetric tensor.

IsSymmetric(T): TenSpc -> BoolElt

Decides if every tensor in the tensor space is a symmetric tensor.

UniversalTensorSpace(T): TenSpc -> TenSpc
UniversalCotensorSpace(T): TenSpc -> TenSpc
Generic(T): TenSpc -> TenSpc

Returns the universal (co-)tensor space with the same frame and category as \(T\).

Example: Subspace of Alternating Tensors (ex-c56f94)

Run in calculator (opens in a new tab)

We construct the subspace of alternating tensors \(S\) of the tensor space \(T\) with the frame \({\mathbb{Q}}^6\times{\mathbb{Q}}^6\rightarrowtail {\mathbb{Q}}^2\). We verify that the space is in fact alternating (i.e. every tensor is alternating).

> T := KTensorSpace(Rationals(), [6,6,2]);
> S := AlternatingSpace(T);
> S;
Tensor space of dimension 30 over Rational Field with valence 3
U2 : Full Vector space of degree 6 over Rational Field
U1 : Full Vector space of degree 6 over Rational Field
U0 : Full Vector space of degree 2 over Rational Field
> IsAlternating(S);
true

From \(S\), we construct the universal tensor space \(U\), which in this example is equal to \(T\).

> U := UniversalTensorSpace(S);
> U;
Tensor space of dimension 72 over Rational Field with valence 3
U2 : Full Vector space of degree 6 over Rational Field
U1 : Full Vector space of degree 6 over Rational Field
U0 : Full Vector space of degree 2 over Rational Field
> U eq T;
true

Run in calculator (opens in a new tab)