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.

Contents

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ν, ..., d0], returns the universal tensor space oslasha∈[ν] Kda 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ν, ..., d0], returns the universal tensor space oslasha∈[ν] Rda with covariant tensor category given by C. The default category is the homotopism category.

Example Multilinear_UniversalKTenSpc (H62E47)

We demonstrate how to construct universal tensor spaces from a field K=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 Q6 x Q5 x Q4 ↣ Q3.

> 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
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ν, ..., U0] of R-modules returns a universal tensor space equivalent to oslasha∈[ν] Ua 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 Multilinear_UniversalTenSpc (H62E48)

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 Z3.

> 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:
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=Kd 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, ..., p V, V * , ..., q V * , K] and the tensor category with arrows [1, ..., p 1, - 1, ..., q - 1, 0] and duplicates {{p + q, ..., 1 + q}, {q, ..., 1}, {0}}. The valence of the returned tensor space will be p + q + 1.

Example Multilinear_SignaturedTenSpc (H62E49)

Here we simply demonstrate the nuances of the signatured tensor space constructor. We set V=GF(5)4, p=3, and q=2, and the tensor space we will construct will have frame V x V x V x V * x V * ↣ GF(5). Notice this is equivalent to the frame V x V x V ↣ V x 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
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ν, ..., d1] returns the universal cotensor space bigotimes_(a∈bar(0))Kda 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ν, ..., U1] of K-vector spaces returns the universal tensor space equivalent to bigotimes_(a∈bar(0))Ua 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 Multilinear_UniversalCoTenSpc (H62E50)

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 U0. It is automatically set to U0=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 ]
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 Multilinear_StandardTenSubspcs (H62E51)

We will construct some standard tensor subspaces of the universal tensor space with frame GF(3)4 x GF(3)4 ↣ GF(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)
ExteriorCotensorSpace(V, n) : ModTupFld, RngIntElt -> TenSpc
Returns the cotensor space given by the nth exterior power of the vector space V.
SymmetricCotensorSpace(V, n) : ModTupFld, RngIntElt -> TenSpc
Returns the cotensor space given by the nth symmetric power of the vector space V.

Example Multilinear_StandardCoTenSubspcs (H62E52)

We set V=GF(5)6 and we construct the cotensor space of the symmetric square of V, V^ V. The frame is V x V ↣ GF(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 < t| : V x V ↣ GF(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 x V ↣ V^ 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

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 Multilinear_Coercion (H62E53)

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]
]
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 Multilinear_TenSpcContainment (H62E54)

We construct the universal tensor space T with the frame GF(2)4 x GF(2)4 ↣ GF(2)4. We also create a tensor space T2 with frame GF(2)4 x GF(2) x GF(2)4 x GF(2) ↣ GF(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 T2. Since the tensors of T naturally embed into T2, the subspace S can be coerced into T2, which we label as S2. We then verify that S2 is a subset of T2 and not T.

> S subset T2;
false
> S2 := T2!S;
> S2 subset T2;
true
> S2 subset T;
false
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 ith 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 Multilinear_BasicModule (H62E55)

We demonstrate the basic module functions of tensor spaces. We construct the universal tensor space T with frame GF(8)3 x GF(8)5 ↣ GF(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
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 oslashs∈S Rs, with category C. The default category is the homotopism category.

Example Multilinear_RandomTensors (H62E56)

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 GF(3)4 x GF(3)4 ↣ GF(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]
]
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 ∏k=1n Rd ↣ Rc. If S is given instead, then we assume S=[d, ..., 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 ∏k=1n Rd ↣ Rc. If S is given instead, then we assume S=[d, ..., 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 ∏k=1n Rd ↣ Rc. If S is given instead, then we assume S=[d, ..., 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 Multilinear_RandomSymTen (H62E57)

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
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 Multilinear_TenSpcProperties (H62E58)

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
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 Multilinear_TenSpcCategories (H62E59)

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 })
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 Multilinear_UniversalConst (H62E60)

We construct the subspace of alternating tensors S of the tensor space T with the frame Q6 x Q6 ↣ Q2. 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
V2.28, 13 July 2023