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 a multilinear map. Each tensor space further maintains a tensor category which is assigned to its tensors.
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.
For a field K and sequence S=[dv, ..., d0], returns the universal tensor space homK(Kdv, ... , homK(Kd1, Kd0) ... ) isomorphic to Kdv ... d0 with covariant tensor category given by C. The default is Albert's homotopism category.
For a commutative and unital ring R and sequence S=[dv, ..., d0], returns the universal tensor space homR(Rdv, ... , homR(Rd1, Rd0) ... ) isomorphic to Rdv ... d0 with covariant tensor category given by C. The default is Albert's homotopism category.
Given a sequence S=[Uv, ..., U0] of K-modules returns a universal tensor space equivalent to homK(Uv tensor K ... tensor K U1, U0) with covariant tensor category given by C. The default is Albert's homotopism category.
Returns the signatured (p, q)-tensor space over the vector space V=Kd. The first p indices are covariant and the last q indices are contravariant. This is functionally equivalent to creating a universal tensor space from the sequence [V, ..., p V, V * , ..., q V * ] and the tensor category with arrows [1, ..., p 1, - 1, ..., q - 1] and duplicates {{p + q, ..., 1 + q}, {q, ..., 1}, {0}}.
> TS := KTensorSpace(Rationals(),[ i : i in [3..7] ]); > TS; Tensor space of dimension 2520 over Rational Field with valence 4 U4 : Full Vector space of degree 3 over Rational Field U3 : Full Vector space of degree 4 over Rational Field U2 : Full Vector space of degree 5 over Rational Field U1 : Full Vector space of degree 6 over Rational Field U0 : Full Vector space of degree 7 over Rational Field > > TS.1; Tensor of valence 4, U4 x U3 x U2 x U1 >-> U0 U4 : Full Vector space of degree 3 over Rational Field U3 : Full Vector space of degree 4 over Rational Field U2 : Full Vector space of degree 5 over Rational Field U1 : Full Vector space of degree 6 over Rational Field U0 : Full Vector space of degree 7 over Rational FieldGive a tensor space a frame.
> R := pAdicRing(3,6); > Fr := [RSpace(R,5), sub<RSpace(R,3)|[0,1,0],[0,0,1]>, > RSpace(R,2)]; > TS := TensorSpace(Fr); > TS; Tensor space of dimension 20 over 3-adic ring mod 3^6 with valence 2 U2 : Full RSpace of degree 5 over pAdicRing(3, 6) U1 : RSpace of degree 3, dimension 2 over pAdicRing(3, 6) Generators: (0 1 0) (0 0 1) Echelonized basis: (0 1 0) (0 0 1) U0 : Full RSpace of degree 2 over pAdicRing(3, 6) > > TS.10; Tensor of valence 2, U2 x U1 >-> U0 U2 : Full RSpace of degree 5 over pAdicRing(3, 6) U1 : RSpace of degree 3, dimension 2 over pAdicRing(3, 6) Generators: (0 1 0) (0 0 1) Echelonized basis: (0 1 0) (0 0 1) U0 : Full RSpace of degree 2 over pAdicRing(3, 6)With signatured tensor spaces, the tensor category is not immediately obvious at print out. Instead, one can glean categorical information using TensorCategory on a tensor space.
> TS := TensorSpace( VectorSpace(GF(3),3), 2, 4 );
> TS;
Tensor space of dimension 729 over GF(3) with valence 6
U6 : Full Vector space of degree 3 over GF(3)
U5 : Full Vector space of degree 3 over GF(3)
U4 : Full Vector space of degree 3 over GF(3)
U3 : Full Vector space of degree 3 over GF(3)
U2 : Full Vector space of degree 3 over GF(3)
U1 : Full Vector space of degree 3 over GF(3)
U0 : Full Vector space of degree 1 over GF(3)
>
> TensorCategory(TS);
Tensor category of Valence 6 (<-,<-,->,->,->,->,==)
({ 0 },{ 5 .. 6 },{ 1 .. 4 })
We see that the indices 5 and 6 are contravariant and both are linked together as well. Furthermore the covariant indices are 1--4, which are also linked together.
We only consider cotensor spaces over fields.
For a field K and sequence S=[dv, ..., d1] returns the universal cotensor space homK(Kdv tensor ... tensor Kd1, K) isomorphic to Kdv ... d1 with the given contravariant tensor category C. The default is Albert's homotopism category.
Given a sequence S=[Uv, ..., U1] of K-vector spaces returns the universal tensor space equivalent to homK(Uv tensor K ... tensor K U1, K) with contravariant tensor category given by C. The default is Albert's homotopism category.
> CT := KCotensorSpace(GF(2),[ i : i in [5..7] ]);
> CT;
Cotensor space of dimension 210 over GF(2) with valence 2
U3 : Full Vector space of degree 5 over GF(2)
U2 : Full Vector space of degree 6 over GF(2)
U1 : Full Vector space of degree 7 over GF(2)
>
> CT.1;
Cotensor of valence 2, U3 x U2 x U1 >-> K
U3 : Full Vector space of degree 5 over GF(2)
U2 : Full Vector space of degree 6 over GF(2)
U1 : Full Vector space of degree 7 over GF(2)
>
>
> Cat := CotensorCategory([1,0,-1],{{1},{2},{3}});
> Fr := [ VectorSpace(GF(8),4) : i in [1..3] ];
> CT := CotensorSpace( Fr, Cat );
> CT;
Cotensor space of dimension 64 over GF(2^3) with valence 2
U3 : Full Vector space of degree 4 over GF(2^3)
U2 : Full Vector space of degree 4 over GF(2^3)
U1 : Full Vector space of degree 4 over GF(2^3)
>
> TensorCategory(CT);
Cotensor category of valence 2 (->,==,<-) ({ 1 },{ 2 },{ 3 })
We include some subspaces generated by well-known tensors.
Returns the sub(co-)tensor space generated by all the alternating (co-)tensors contained in the given (co-)tensor space.
Returns the sub(co-)tensor space generated by all the antisymmetric (co-)tensors contained in the given (co-)tensor space.
Returns the sub(co-)tensor space generated by all the symmetric (co-)tensors contained in the given (co-)tensor space.
Returns the cotensor space given by the nth exterior power of the vector space V.
Returns the cotensor space given by the nth symmetric power of the vector space V.
> TS := KTensorSpace(GF(3), [3,3,3,2]);
> TS;
Tensor space of dimension 54 over GF(3) with valence 3
U3 : Full Vector space of degree 3 over GF(3)
U2 : Full Vector space of degree 3 over GF(3)
U1 : Full Vector space of degree 3 over GF(3)
U0 : Full Vector space of degree 2 over GF(3)
>
> SS := SymmetricSpace(TS);
> AsMatrices(Random(SS),3,2);
[
[1 1 1]
[1 0 0]
[1 0 0],
[2 2 2]
[2 0 1]
[2 1 0],
[1 0 0]
[0 1 2]
[0 2 2],
[2 0 1]
[0 1 1]
[1 1 2],
[1 0 0]
[0 2 2]
[0 2 1],
[2 1 0]
[1 1 2]
[0 2 0]
]
For V=F256, we construct the fourth exterior power of V, Λ4(V)
as a sub cotensor space of dimension 6 choose (4)=15.
> V := VectorSpace(GF(25),6); > E := ExteriorCotensorSpace(V,4); > E; Cotensor space of dimension 15 over GF(5^2) with valence 3 U4 : Full Vector space of degree 6 over GF(5^2) U3 : Full Vector space of degree 6 over GF(5^2) U2 : Full Vector space of degree 6 over GF(5^2) U1 : Full Vector space of degree 6 over GF(5^2) > T := Random(E); > IsAlternating(T); true
Returns the derivation closure of the given tensor space TS, with frame U2 x U1 ↣ U0, with operators O⊆(End)(U2) x (End)(U1) x (End)(U0). Currently, this only works for tensor spaces of valence 2. This is the subspace whose tensors' derivation algebra contains O.
Returns the derivation closure of the given tensor space TS, with frame U2 x U1 ↣ U0, with operators O⊆(End)(U2) x (End)(U1) x (End)(U0). Currently, this only works for tensor spaces of valence 2. This is the subspace whose tensors' derivation algebra contains the derivation algebra of T.
Returns the nucleus closure of the tensor space TS, with frame U2 x U1 ↣ U0, with operators O⊆(End)(Us) x (End)(Ut). Currently, this only works for tensor spaces of valence 2. This returns the subspace whose tensors' st-nuclues contains O.
Returns the nucleus closure of the tensor space TS, with frame U2 x U1 ↣ U0, with operators O⊆(End)(Us) x (End)(Ut). Currently, this only works for tensor spaces of valence 2. This returns the subspace whose tensors' st-nuclues contains the st-nucleus of T.
> Fr := [ KMatrixSpace(GF(3),2,3), > KMatrixSpace(GF(3),3,2),KMatrixSpace(GF(3),2,2) ]; > F := func< x | x[1]*x[2] >; > T := Tensor(Fr,F); > T; Tensor of valence 2, U2 x U1 >-> U0 U2 : Full KMatrixSpace of 2 by 3 matrices over GF(3) U1 : Full KMatrixSpace of 3 by 2 matrices over GF(3) U0 : Full KMatrixSpace of 2 by 2 matrices over GF(3) > > TS := Parent(T); > TS; Tensor space of dimension 144 over GF(3) with valence 2 U2 : Full Vector space of degree 6 over GF(3) U1 : Full Vector space of degree 6 over GF(3) U0 : Full Vector space of degree 4 over GF(3) > > D := DerivationClosure(TS,T); > D; Tensor space of dimension 1 over GF(3) with valence 2 U2 : Full Vector space of degree 6 over GF(3) U1 : Full Vector space of degree 6 over GF(3) U0 : Full Vector space of degree 4 over GF(3)
> H := ClassicalSylow( GL(3,125), 5 ); // Heisenberg group > T := pCentralTensor(H,5,1,1); > T; Tensor of valence 2, 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 3 over GF(5)The centroid of T will be 3-dimensional and is isomorphic to F125.
> C := Centroid(T); > C; Matrix Algebra of degree 15 with 3 generators over GF(5) > > S := TensorOverCentroid(T); > S; Tensor of valence 2, U2 x U1 >-> U0 U2 : Full Vector space of degree 2 over GF(5^3) U1 : Full Vector space of degree 2 over GF(5^3) U0 : Full Vector space of degree 1 over GF(5^3) > > TS := Parent(S); > N := NucleusClosure(TS,S,2,1); > N; Tensor space of dimension 1 over GF(5^3) with valence 2 U2 : Full Vector space of degree 2 over GF(5^3) U1 : Full Vector space of degree 2 over GF(5^3) U0 : Full Vector space of degree 1 over GF(5^3)Compare this closure with the closure of our original tensor over F5.
> NT := NucleusClosure(Parent(T),T,2,1); > NT; Tensor space of dimension 36 over GF(5) with valence 2 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 3 over GF(5)
We define some intuitive functions for tensor spaces, similar to those found for modules.
Decides if T is contained in the tensor space TS.
Decides if the tensor T can be coerced into the tensor space TS. If so, the tensor is returned as an element of TS.
Decides if the sequence S can be coerced into the tensor space TS as a tensor. If so, the corresponding tensor is returned.
Decides if the tensor spaces S and T are equal.
Decides if S is a subset of the tensor space T.
> TS := KTensorSpace( GF(2), [2,3,2] ); > TS; Tensor space of dimension 12 over GF(2) with valence 2 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 := [ Random(GF(2)) : i in [1..12] ]; > T := TS!S; > T; Tensor of valence 2, 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); trueWe demonstrate how to coerce into the symmetric cube of V=Q10 and construct a subcotensor space.
> V := VectorSpace(Rationals(),10); > SS := SymmetricCotensorSpace(V,3); > SS; Cotensor space of dimension 220 over Rational Field with valence 2 U3 : Full Vector space of degree 10 over Rational Field U2 : Full Vector space of degree 10 over Rational Field U1 : Full Vector space of degree 10 over Rational Field > > CT := SubtensorSpace(SS,SS![1..1000]); > CT; Cotensor space of dimension 1 over Rational Field with valence 2 U3 : Full Vector space of degree 10 over Rational Field U2 : Full Vector space of degree 10 over Rational Field U1 : Full Vector space of degree 10 over Rational Field > > CT subset SS; true > CT.1 in SS; true > SS.2 in CT; false
We view a tensor space as a K-module, so we have notions of generators, dimension (if it is free), and cardinality.
Returns a sequence of generators for the tensor space.
Returns the ith generator of the tensor space T.
Returns the number of generators of the tensor space T.
Returns the dimension of the tensor space T as a free K-module.
Returns the size of the tensor space, provided it is finite.
Provided the base ring has a random algorithm in Magma, it returns a random element of the tensor space T.
Provided R has a random algorithm in Magma, it returns a random tensor from the tensor space homR(Rdv, ..., homR(Rd1, Rd0) ... ) with category C. The default category is the homotopism category.
> TS := KTensorSpace( GF(9), [2,2,2,2] ); > TS; Tensor space of dimension 16 over GF(3^2) with valence 3 U3 : Full Vector space of degree 2 over GF(3^2) U2 : Full Vector space of degree 2 over GF(3^2) U1 : Full Vector space of degree 2 over GF(3^2) U0 : Full Vector space of degree 2 over GF(3^2) > > Ngens(TS); 16 > #TS eq 9^Ngens(TS); true > > Eltseq(TS.2); [ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]We can use RandomTensor to get a random tensor or cotensor from scratch.
> T := RandomTensor(GF(3),[2,2,2]);
> T;
Tensor of valence 2, U2 x U1 >-> U0
U2 : Full Vector space of degree 2 over GF(3)
U1 : Full Vector space of degree 2 over GF(3)
U0 : Full Vector space of degree 2 over GF(3)
>
> Cat := CotensorCategory([1,1,1],{{1,2,3}});
> T := RandomTensor(GF(3),[2,2,2],Cat);
> T;
Cotensor of valence 2, U3 x U2 x U1 >-> K
U3 : Full Vector space of degree 2 over GF(3)
U2 : Full Vector space of degree 2 over GF(3)
U1 : Full Vector space of degree 2 over GF(3)
We define some functions to access basic properties of tensor spaces.
Returns the valence of the tensor space.
Returns the list of modules in the frame of the tensor space.
Returns the base ring (or field) of the tensor space.
Returns the underlying tensor category of the tensor space.
Decides if the underlying tensor category is covariant or contravariant.
Returns the tensor category with the given tensor category.
Decides if every tensor in the tensor space is an alternating tensor.
Decides if every tensor in the tensor space is an antisymmetric tensor.
Decides if every tensor in the tensor space is a symmetric tensor.
Returns the universal (co-)tensor space with the same frame and category as T.
> TS := KTensorSpace( GF(23), [3,4,5,6] );
> TS;
Tensor space of dimension 360 over GF(23) with valence 3
U3 : Full Vector space of degree 3 over GF(23)
U2 : Full Vector space of degree 4 over GF(23)
U1 : Full Vector space of degree 5 over GF(23)
U0 : Full Vector space of degree 6 over GF(23)
>
> Valence(TS);
3
> Frame(TS);
[*
Full Vector space of degree 3 over GF(23),
Full Vector space of degree 4 over GF(23),
Full Vector space of degree 5 over GF(23),
Full Vector space of degree 6 over GF(23)
*]
> TensorCategory(TS);
Tensor category of Valence 3 (->,->,->,->)
({ 1 },{ 2 },{ 0 },{ 3 })
>
> Cat := TensorCategory([1,1,-1,-1],{{0},{1},{2},{3}});
> ChangeTensorCategory(~TS,Cat);
> TensorCategory(TS);
Tensor category of Valence 3 (->,->,<-,<-)
({ 1 },{ 2 },{ 0 },{ 3 })
We construct the universal cotensor space of the symmetric cube, S3(V), of a vector space V.
> V := VectorSpace( GF(3), 5 ); > S := SymmetricCotensorSpace(V,3); > S; Cotensor space of dimension 30 over GF(3) with valence 2 U3 : Full Vector space of degree 5 over GF(3) U2 : Full Vector space of degree 5 over GF(3) U1 : Full Vector space of degree 5 over GF(3) > UniversalCotensorSpace(S); Cotensor space of dimension 125 over GF(3) with valence 2 U3 : Full Vector space of degree 5 over GF(3) U2 : Full Vector space of degree 5 over GF(3) U1 : Full Vector space of degree 5 over GF(3) > > IsSymmetric(S); true