[ref] 60 Algebras

[Top] [Up] [Previous] [Next] [Index]

# 60 Algebras

### Sections

1. Constructing Algebras by Generators
2. Constructing Algebras as Free Algebras
3. Constructing Algebras by Structure Constants
4. Some Special Algebras
5. Subalgebras
6. Ideals
7. Categories and Properties of Algebras
8. Attributes and Operations for Algebras
9. Homomorphisms of Algebras
10. Representations of Algebras

An algebra is a vector space equipped with a bilinear map (multiplication). This chapter describes the functions in GAP that deal with general algebras and associative algebras.

Algebras in GAP are vector spaces in a natural way. So all the functionality for vector spaces (see Chapter vector spaces) is also applicable to algebras.

- `InfoAlgebra V`

  is the info class for the functions dealing with algebras (see Info Functions).

  ## 60.1 Constructing Algebras by Generators

- `Algebra(` F`,` gens`) F`
- `Algebra(` F`,` gens`,` zero`) F`
- `Algebra(` F`,` gens`, "basis" ) F`
- `Algebra(` F`,` gens`,` zero`, "basis" ) F`

  `Algebra(` F`,` gens`)` is the algebra over the division ring F, generated by the vectors in the list gens.

  If there are three arguments, a division ring F and a list gens and an element zero, then `Algebra(` F`,` gens`,` zero`)` is the F-algebra generated by gens, with zero element zero.

  If the last argument is the string `"basis"` then the vectors in gens are known to form a basis of the algebra (as an F-vector space).

      gap> m:= [ [ 0, 1, 2 ], [ 0, 0, 3], [ 0, 0, 0 ] ];;
      gap> A:= Algebra( Rationals, [ m ] );
      <algebra over Rationals, with 1 generators>
      gap> Dimension( A );
      2

- `AlgebraWithOne(` F`,` gens`) F`
- `AlgebraWithOne(` F`,` gens`,` zero`) F`
- `AlgebraWithOne(` F`,` gens`, "basis" ) F`
- `AlgebraWithOne(` F`,` gens`,` zero`, "basis" ) F`

  `AlgebraWithOne(` F`,` gens`)` is the algebra-with-one over the division ring F, generated by the vectors in the list gens.

  If there are three arguments, a division ring F and a list gens and an element zero, then `AlgebraWithOne(` F`,` gens`,` zero`)` is the F-algebra-with-one generated by gens, with zero element zero.

  If the last argument is the string `"basis"` then the vectors in gens are known to form a basis of the algebra (as an F-vector space).

      gap> m:= [ [ 0, 1, 2 ], [ 0, 0, 3], [ 0, 0, 0 ] ];;
      gap> A:= AlgebraWithOne( Rationals, [ m ] );
      <algebra-with-one over Rationals, with 1 generators>
      gap> Dimension( A );
      3
      gap> One(A);
      [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ]

  ## 60.2 Constructing Algebras as Free Algebras

- `FreeAlgebra(` R`,` rank`) F`
- `FreeAlgebra(` R`,` rank`,` name`) F`
- `FreeAlgebra(` R`,` name1`,` name2`, ... ) F`

  is a free (nonassociative) algebra of rank rank over the ring R. Here name, and name1, name2,... are optional strings that can be used to provide names for the generators.

      gap> A:= FreeAlgebra( Rationals, "a", "b" );
      <algebra over Rationals, with 2 generators>
      gap> g:= GeneratorsOfAlgebra( A );
      [ (1)*a, (1)*b ]
      gap> (g[1]*g[2])*((g[2]*g[1])*g[1]);
      (1)*((a*b)*((b*a)*a))

- `FreeAlgebraWithOne(` R`,` rank`) F`
- `FreeAlgebraWithOne(` R`,` rank`,` name`) F`
- `FreeAlgebraWithOne(` R`,` name1`,` name2`, ... ) F`

  is a free (nonassociative) algebra-with-one of rank rank over the ring R. Here name, and name1, name2,... are optional strings that can be used to provide names for the generators.

      gap> A:= FreeAlgebraWithOne( Rationals, 4, "q" );
      <algebra-with-one over Rationals, with 4 generators>
      gap> GeneratorsOfAlgebra( A );
      [ (1)*<identity ...>, (1)*q.1, (1)*q.2, (1)*q.3, (1)*q.4 ]
      gap> One( A );
      (1)*<identity ...>

- `FreeAssociativeAlgebra(` R`,` rank`) F`
- `FreeAssociativeAlgebra(` R`,` rank`,` name`) F`
- `FreeAssociativeAlgebra(` R`,` name1`,` name2`, ... ) F`

  is a free associative algebra of rank rank over the ring R. Here name, and name1, name2,... are optional strings that can be used to provide names for the generators.

      gap> A:= FreeAssociativeAlgebra( GF( 5 ), 4, "a" );
      <algebra over GF(5), with 4 generators>

- `FreeAssociativeAlgebraWithOne(` R`,` rank`) F`
- `FreeAssociativeAlgebraWithOne(` R`,` rank`,` name`) F`
- `FreeAssociativeAlgebraWithOne(` R`,` name1`,` name2`, ... ) F`

  is a free associative algebra-with-one of rank rank over the ring R. Here name, and name1, name2,... are optional strings that can be used to provide names for the generators.

      gap> A:= FreeAssociativeAlgebraWithOne( Rationals, "a", "b", "c" );
      <algebra-with-one over Rationals, with 3 generators>
      gap> GeneratorsOfAlgebra( A );
      [ (1)*<identity ...>, (1)*a, (1)*b, (1)*c ]
      gap> One( A );
      (1)*<identity ...>

  ## 60.3 Constructing Algebras by Structure Constants

  For an introduction into structure constants and how they are handled by GAP, we refer to Section Algebras of the user's tutorial.

- `EmptySCTable(` dim`,` zero`) F`
- `EmptySCTable(` dim`,` zero`, "symmetric" ) F`
- `EmptySCTable(` dim`,` zero`, "antisymmetric" ) F`

  `EmptySCTable` returns a structure constants table for an algebra of dimension dim, describing trivial multiplication. zero must be the zero of the coefficients domain. If the multiplication is known to be (anti)commutative then this can be indicated by the optional third argument.

  For filling up the structure constants table, see SetEntrySCTable.

      gap> EmptySCTable( 2, Zero( GF(5) ), "antisymmetric" );
      [ [ [ [  ], [  ] ], [ [  ], [  ] ] ], [ [ [  ], [  ] ], [ [  ], [  ] ] ], -1,
        0*Z(5) ]

- `SetEntrySCTable(` T`,` i`,` j`,` list`) F`

  sets the entry of the structure constants table T that describes the product of the i-th basis element with the j-th basis element to the value given by the list list.

  If T is known to be antisymmetric or symmetric then also the value ``T`[`j`][`i`]` is set.

  list must be of the form [ cijk1, k1, cijk2, k2, ¼].

  The entries at the odd positions of list must be compatible with the zero element stored in T. For convenience, these entries may also be rational numbers that are automatically replaced by the corresponding elements in the appropriate prime field in finite characteristic if necessary.

      gap> T:= EmptySCTable( 2, 0 );;
      gap> SetEntrySCTable( T, 1, 1, [ 1/2, 1, 2/3, 2 ] );
      gap> T;
      [ [ [ [ 1, 2 ], [ 1/2, 2/3 ] ], [ [  ], [  ] ] ],
        [ [ [  ], [  ] ], [ [  ], [  ] ] ], 0, 0 ]

- `GapInputSCTable(` T`,` varname`) F`

  is a string that describes the structure constants table T in terms of `EmptySCTable` and `SetEntrySCTable`. The assignments are made to the variable varname.

      gap> T:= EmptySCTable( 2, 0 );;
      gap> SetEntrySCTable( T, 1, 2, [ 1, 2 ] );
      gap> SetEntrySCTable( T, 2, 1, [ 1, 2 ] );
      gap> GapInputSCTable( T, "T" );
      "T:= EmptySCTable( 2, 0 );\nSetEntrySCTable( T, 1, 2, [1,2] );\nSetEntrySCTabl\
      e( T, 2, 1, [1,2] );\n"

- `TestJacobi(` T`) F`

  tests whether the structure constants table T satisfies the Jacobi identity vi*(vj*vk)+vj*(vk*vi)+vk*(vi*vj)=0 for all basis vectors vi of the underlying algebra, where i £ j £ k. (Thus antisymmetry is assumed.)

  The function returns `true` if the Jacobi identity is satisfied, and a failing triple `[ i, j, k ]` otherwise.

      gap> T:= EmptySCTable( 2, 0, "antisymmetric" );;
      gap> SetEntrySCTable( T, 1, 2, [ 1, 2 ] );;
      gap> TestJacobi( T );
      true

- `AlgebraByStructureConstants(` R`,` sctable`) F`
- `AlgebraByStructureConstants(` R`,` sctable`,` name`) F`
- `AlgebraByStructureConstants(` R`,` sctable`,` names`) F`
- `AlgebraByStructureConstants(` R`,` sctable`,` name1`,` name2`, ... ) F`

  returns a free left module A over the ring R, with multiplication defined by the structure constants table sctable. Here name and name1, name2, `...` are optional strings that can be used to provide names for the elements of the canonical basis of A. names is a list of strings that can be entered instead of the specific names name1, name2, `...`. The vectors of the canonical basis of A correspond to the vectors of the basis given by sctable.

  It is not checked whether the coefficients in sctable are really elements in R.

      gap> T:= EmptySCTable( 2, 0 );;
      gap> SetEntrySCTable( T, 1, 1, [ 1/2, 1, 2/3, 2 ] );
      gap> A:= AlgebraByStructureConstants( Rationals, T );
      <algebra of dimension 2 over Rationals>
      gap> b:= BasisVectors( Basis( A ) );;
      gap> b[1]^2;
      (1/2)*v.1+(2/3)*v.2
      gap> b[1]*b[2];
      0*v.1

- `IdentityFromSCTable(` T`) F`

  Let T be a structure constants table of an algebra A of dimension n. `IdentityFromSCTable(` T`)` is either `fail` or the vector of length n that contains the coefficients of the multiplicative identity of A with respect to the basis that belongs to T.

      gap> T:= EmptySCTable( 2, 0 );;
      gap> SetEntrySCTable( T, 1, 1, [ 1, 1 ] );;
      gap> SetEntrySCTable( T, 1, 2, [ 1, 2 ] );;
      gap> SetEntrySCTable( T, 2, 1, [ 1, 2 ] );;
      gap> IdentityFromSCTable( T );
      [ 1, 0 ]

- `QuotientFromSCTable(` T`,` num`,` den`) F`

  Let T be a structure constants table of an algebra A of dimension n. `QuotientFromSCTable(` T`)` is either `fail` or the vector of length n that contains the coefficients of the quotient of num and den with respect to the basis that belongs to T.

  We solve the equation system num = x den . If no solution exists, `fail` is returned.

  In terms of the basis B with vectors b1, ¼, bn this means for num = åi=1n ai bi, den = åi=1n ci bi, x = åi=1n xi bi that ak = åi,j ci xj cijk for all k. Here cijk denotes the structure constants with respect to B. This means that (as a vector) a=xM with Mjk = åi=1n cijk ci.

      gap> T:= EmptySCTable( 2, 0 );;
      gap> SetEntrySCTable( T, 1, 1, [ 1, 1 ] );;
      gap> SetEntrySCTable( T, 2, 1, [ 1, 2 ] );;
      gap> SetEntrySCTable( T, 1, 2, [ 1, 2 ] );;
      gap> QuotientFromSCTable( T, [0,1], [1,0] );
      [ 0, 1 ]

  ## 60.4 Some Special Algebras

- `QuaternionAlgebra(` F`) F`
- `QuaternionAlgebra(` F`,` a`,` b`) F`

  is a quaternion algebra over the field F with parameters a and b in F, i.e., a four-dimensional associative F-algebra with basis (e,i,j,k) and multiplication defined by e e = e, e i = i e = i, e j = j e = j, e k = k e = k, i i = a e, i j = - j i = k, i k = - k i = a j, j j = b e, j k = - k j = b i, k k = - a b e. The default value for both a and b is -1 Î F .

  The `GeneratorsOfAlgebra` (see GeneratorsOfAlgebra) and `CanonicalBasis` (see CanonicalBasis) value of an algebra constructed with `QuaternionAlgebra` is the list [ e, i, j, k ].

  The embedding of the field `GaussianRationals` into a quaternion algebra A over `Rationals` is not uniquely determined. One can specify one as a vector space homomorphism that maps `1` to the first algebra generator of A, and `E(4)` to one of the others.

      gap> QuaternionAlgebra( Rationals );
      <algebra-with-one of dimension 4 over Rationals>

- `ComplexificationQuat(` vector`) F`
- `ComplexificationQuat(` matrix`) F`

  Let A = e F Åi F Åj F Åk F be a quaternion algebra over the field F of cyclotomics, with basis (e,i,j,k).

  If v = v1 + v2 j is a row vector over A with v1 = e w1 + i w2 and v2 = e w3 + i w4 then `ComplexificationQuat( v )` is the concatenation of w1 + `E``(``4``)` w2 and w3 + `E``(``4``)` w4.

  If M = M1 + M2 j is a matrix over A with M1 = e N1 + i N2 and M2 = e N3 + i N4 then `ComplexificationQuat(` M`)` is the block matrix A over e F Åi F such that A(1,1)=N1 + `E``(``4``)` N2, A(2,2)=N1 - `E``(``4``)` N2, A(1,2)=N3 + `E``(``4``)` N4 and A(2,1) = - N3 + `E``(``4``)` N4.

  Then `ComplexificationQuat(`v`)*ComplexificationQuat(`M`)= ComplexificationQuat(`v`*`M`)`, since

  v M = v1 M1 + v2 j M1 + v1 M2 j + v2 j M2 j = ( v1 M1 - v2 | M2 | ) + ( v1 M2 + v2 | M1 | ) j.

- `OctaveAlgebra(` F`) F`

  The algebra of octonions over F.

      gap> OctaveAlgebra( Rationals );
      <algebra of dimension 8 over Rationals>

- `FullMatrixAlgebra(` R`,` n`) F`
- `MatrixAlgebra(` R`,` n`) F`
- `MatAlgebra(` R`,` n`) F`

  is the full matrix algebra R n ×n , for a ring R and a nonnegative integer n.

      gap> A:=FullMatrixAlgebra( Rationals, 20 );
      ( Rationals^[ 20, 20 ] )
      gap> Dimension( A );
      400

- `NullAlgebra(` R`) A`

  The zero-dimensional algebra over R.

      gap> A:= NullAlgebra( Rationals );
      <algebra over Rationals>
      gap> Dimension( A );
      0

  ## 60.5 Subalgebras

- `Subalgebra(` A`,` gens`) F`
- `Subalgebra(` A`,` gens`, "basis" ) F`

  is the F-algebra generated by gens, with parent algebra A, where F is the left acting domain of A.

  Note that being a subalgebra of A means to be an algebra, to be contained in A, and to have the same left acting domain as A.

  An optional argument `"basis"` may be added if it is known that the generators already form a basis of the algebra. Then it is not checked whether gens really are linearly independent and whether all elements in gens lie in A.

      gap> m:= [ [ 0, 1, 2 ], [ 0, 0, 3], [ 0, 0, 0 ] ];;
      gap> A:= Algebra( Rationals, [ m ] );
      <algebra over Rationals, with 1 generators>
      gap> B:= Subalgebra( A, [ m^2 ] );
      <algebra over Rationals, with 1 generators>

- `SubalgebraNC(` A`,` gens`) F`
- `SubalgebraNC(` A`,` gens`, "basis" ) F`

  `SubalgebraNC` constructs the subalgebra generated by gens, only it does not check whether all elements in gens lie in A.

      gap> m:= RandomMat( 3, 3 );;
      gap> A:= Algebra( Rationals, [ m ] );
      <algebra over Rationals, with 1 generators>
      gap> SubalgebraNC( A, [ IdentityMat( 3, 3 ) ], "basis" );
      <algebra of dimension 1 over Rationals>

- `SubalgebraWithOne(` A`,` gens`) F`
- `SubalgebraWithOne(` A`,` gens`, "basis" ) F`

  is the algebra-with-one generated by gens, with parent algebra A.

  The optional third argument `"basis"` may be added if it is known that the elements from gens are linearly independent. Then it is not checked whether gens really are linearly independent and whether all elements in gens lie in A.

      gap> m:= [ [ 0, 1, 2 ], [ 0, 0, 3], [ 0, 0, 0 ] ];;
      gap> A:= AlgebraWithOne( Rationals, [ m ] );
      <algebra-with-one over Rationals, with 1 generators>
      gap> B1:= SubalgebraWithOne( A, [ m ] );;
      gap> B2:= Subalgebra( A, [ m ] );;
      gap> Dimension( B1 );
      3
      gap> Dimension( B2 );
      2

- `SubalgebraWithOneNC(` A`,` gens`) F`
- `SubalgebraWithOneNC(` A`,` gens`, "basis" ) F`

  `SubalgebraWithOneNC` does not check whether all elements in gens lie in A.

      gap> m:= RandomMat( 3, 3 );; A:= Algebra( Rationals, [ m ] );;
      gap> SubalgebraWithOneNC( A, [ m ] );
      <algebra-with-one over Rationals, with 1 generators>

- `TrivialSubalgebra(` A`) A`

  The zero dimensional subalgebra of the algebra A.

      gap> A:= QuaternionAlgebra( Rationals );;
      gap> B:= TrivialSubalgebra( A );
      <algebra over Rationals>
      gap> Dimension( B );
      0

  ## 60.6 Ideals

  For constructing and working with ideals in algebras the same functions are available as for ideals in rings. So for the precise description of these functions we refer to Chapter Rings. Here we give examples demonstrating the use of ideals in algebras. For an introduction into the concstruction of quotient algebras we refer to Chapter algebras of the user's tutorial.

      gap> m:= [ [ 0, 2, 3 ], [ 0, 0, 4 ], [ 0, 0, 0] ];;
      gap> A:= AlgebraWithOne( Rationals, [ m ] );;
      gap> I:= Ideal( A, [ m ] );  # i.e., the two-sided ideal of `A' generated by `m'.
      <two-sided ideal in <algebra-with-one of dimension 3 over Rationals>,
        (1 generators)>
      gap> Dimension( I );
      2
      gap> GeneratorsOfIdeal( I );
      [ [ [ 0, 2, 3 ], [ 0, 0, 4 ], [ 0, 0, 0 ] ] ]
      gap> BasisVectors( Basis( I ) );
      [ [ [ 0, 1, 3/2 ], [ 0, 0, 2 ], [ 0, 0, 0 ] ],
        [ [ 0, 0, 1 ], [ 0, 0, 0 ], [ 0, 0, 0 ] ] ]

      gap> A:= FullMatrixAlgebra( Rationals, 4 );;
      gap> m:= NullMat( 4, 4 );; m[1][4]:=1;;
      gap> I:= LeftIdeal( A, [ m ] );
      <left ideal in ( Rationals^[ 4, 4 ] ), (1 generators)>
      gap> Dimension( I );
      4
      gap> GeneratorsOfLeftIdeal( I );
      [ [ [ 0, 0, 0, 1 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ] ] ]

      gap> mats:= [ [[1,0],[0,0]], [[0,1],[0,0]], [[0,0],[0,1]] ];;
      gap> A:= Algebra( Rationals, mats );;
      gap> # Form the two-sided ideal for which `mats[2]' is known to be
      gap> # the unique basis element.
      gap> I:= Ideal( A, [ mats[2] ], "basis" );
      <two-sided ideal in <algebra of dimension 3 over Rationals>, (dimension 1)>

  ## 60.7 Categories and Properties of Algebras

- `IsFLMLOR(` obj`) C`

  A FLMLOR (``free left module left operator ring'') in GAP is a ring that is also a free left module.

  Note that this means that being a FLMLOR is not a property a ring can get, since a ring is usually not represented as an external left set.

  Examples are magma rings (e.g. over the integers) or algebras.

      gap> A:= FullMatrixAlgebra( Rationals, 2 );;
      gap> IsFLMLOR ( A );
      true

- `IsFLMLORWithOne(` obj`) C`

  A FLMLOR-with-one in GAP is a ring-with-one that is also a free left module.

  Note that this means that being a FLMLOR-with-one is not a property a ring-with-one can get, since a ring-with-one is usually not represented as an external left set.

  Examples are magma rings-with-one or algebras-with-one (but also over the integers).

      gap> A:= FullMatrixAlgebra( Rationals, 2 );;
      gap> IsFLMLORWithOne ( A );
      true

- `IsAlgebra(` obj`) C`

  An algebra in GAP is a ring that is also a left vector space. Note that this means that being an algebra is not a property a ring can get, since a ring is usually not represented as an external left set.

      gap> A:= MatAlgebra( Rationals, 3 );;
      gap> IsAlgebra( A );
      true

- `IsAlgebraWithOne(` obj`) C`

  An algebra-with-one in GAP is a ring-with-one that is also a left vector space. Note that this means that being an algebra-with-one is not a property a ring-with-one can get, since a ring-with-one is usually not represented as an external left set.

      gap> A:= MatAlgebra( Rationals, 3 );;
      gap> IsAlgebraWithOne( A );
      true

- `IsLieAlgebra(` A`) P`

  An algebra A is called Lie algebra if a * a = 0 for all a in A and ( a * ( b * c ) ) + ( b * ( c * a ) ) + ( c * ( a * b ) ) = 0 for all a, b, c in A (Jacobi identity).

      gap> A:= FullMatrixLieAlgebra( Rationals, 3 );;
      gap> IsLieAlgebra( A );
      true

- `IsSimpleAlgebra(` A`) P`

  is `true` if the algebra A is simple, and `false` otherwise. This function is only implemented for the cases where A is an associative or a Lie algebra. And for Lie algebras it is only implemented fot the case where the ground field is of characteristic 0.

      gap> A:= FullMatrixLieAlgebra( Rationals, 3 );;
      gap> IsSimpleAlgebra( A );
      false
      gap> A:= MatAlgebra( Rationals, 3 );;
      gap> IsSimpleAlgebra( A );
      true

- `IsFiniteDimensional(`matalg`) O`

  returns `true` (always) for a matrix algebra matalg, since matrix algebras are always finite dimensional.

      gap> A:= MatAlgebra( Rationals, 3 );;
      gap> IsFiniteDimensional( A );
      true

- `IsQuaternion(` obj`) C`
- `IsQuaternionCollection(` obj`) C`
- `IsQuaternionCollColl(` obj`) C`

  `IsQuaternion` is the category of elements in an algebra constructed by `QuaternionAlgebra`. A collection of quaternions lies in the category `IsQuaternionCollection`. Finally, a collection of quaternion collections (e.g., a matrix) lies in the category `IsQuaternionCollColl`.

      gap> A:= QuaternionAlgebra( Rationals );;
      gap> b:= BasisVectors( Basis( A ) );
      [ e, i, j, k ]
      gap> IsQuaternion( b[1] );
      true
      gap> IsQuaternionCollColl( [ [ b[1], b[2] ], [ b[3], b[4] ] ] );
      true

  ## 60.8 Attributes and Operations for Algebras

- `GeneratorsOfAlgebra(` A`) A`

  returns a list of elements that generate A as an algebra.

      gap> m:= [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ];;
      gap> A:= AlgebraWithOne( Rationals, [ m ] );
      <algebra-with-one over Rationals, with 1 generators>
      gap> GeneratorsOfAlgebra( A );
      [ [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ],
        [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ] ]

- `GeneratorsOfAlgebraWithOne(` A`) A`

  returns a list of elements of A that generate A as an algebra with one.

      gap> m:= [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ];;
      gap> A:= AlgebraWithOne( Rationals, [ m ] );
      <algebra-with-one over Rationals, with 1 generators>
      gap> GeneratorsOfAlgebraWithOne( A );
      [ [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ] ]

- `ProductSpace(` U`,` V`) O`

  is the vector space áu * v ; u Î U, v Î V ñ, where U and V are subspaces of the same algebra.

  If U = V is known to be an algebra then the product space is also an algebra, moreover it is an ideal in U. If U and V are known to be ideals in an algebra A then the product space is known to be an algebra and an ideal in A.

      gap> A:= QuaternionAlgebra( Rationals );;
      gap> b:= BasisVectors( Basis( A ) );;
      gap> B:= Subalgebra( A, [ b[4] ] );
      <algebra over Rationals, with 1 generators>
      gap> ProductSpace( A, B );
      <vector space of dimension 4 over Rationals>

- `PowerSubalgebraSeries(` A`) A`

  returns a list of subalgebras of A, the first term of which is A; and every next term is the product space of the previous term with itself.

      gap> A:= QuaternionAlgebra( Rationals );
      <algebra-with-one of dimension 4 over Rationals>
      gap> PowerSubalgebraSeries( A );
      [ <algebra-with-one of dimension 4 over Rationals> ]

- `AdjointBasis(` B`) A`

  Let x be an element of an algebra A. Then the adjoint map of x is the left multiplication by x. It is a linear map of A. For the basis B of an algebra A, this function returns a particular basis C of the matrix space generated by ad A, (the matrix spaces spanned by the matrices of the left multiplication); namely a basis consisting of elements of the form ad xi, where xi is a basis element of B.

      gap> A:= QuaternionAlgebra( Rationals );;
      gap> AdjointBasis( Basis( A ) );
      Basis( <vector space over Rationals, with 4 generators>,
      [ [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ],
        [ [ 0, -1, 0, 0 ], [ 1, 0, 0, 0 ], [ 0, 0, 0, -1 ], [ 0, 0, 1, 0 ] ],
        [ [ 0, 0, -1, 0 ], [ 0, 0, 0, 1 ], [ 1, 0, 0, 0 ], [ 0, -1, 0, 0 ] ],
        [ [ 0, 0, 0, -1 ], [ 0, 0, -1, 0 ], [ 0, 1, 0, 0 ], [ 1, 0, 0, 0 ] ] ] )

- `IndicesOfAdjointBasis(` B`) A`

  Let A be an algebra and let B be the basis that is output by `AdjointBasis( Basis(` A`) )`. This function returns a list of indices. If i is an index belonging to this list, then ad xi is a basis vector of the matrix space spanned by ad A, where xi is the i-th basis vector of the basis B.

      gap> L:= FullMatrixLieAlgebra( Rationals, 3 );;
      gap> B:= AdjointBasis( Basis( L ) );;
      gap> IndicesOfAdjointBasis( B );
      [ 1, 2, 3, 4, 5, 6, 7, 8 ]

- `AsAlgebra(` F`,` A`) O`

  Returns the algebra over F generated by A.

      gap> V:= VectorSpace( Rationals, [ IdentityMat( 2 ) ] );;
      gap> AsAlgebra( Rationals, V );
      <algebra of dimension 1 over Rationals>

- `AsAlgebraWithOne(` F`,` A`) O`

  If the algebra A has an identity, then it can be viewed as an algebra with one over F. This function returns this algebra with one.

      gap> V:= VectorSpace( Rationals, [ IdentityMat( 2 ) ] );;
      gap> A:= AsAlgebra( Rationals, V );;
      gap> AsAlgebraWithOne( Rationals, A );
      <algebra-with-one over Rationals, with 1 generators>

- `AsSubalgebra(` A`,` B`) O`

  If all elements of the algebra B happen to be contained in the algebra A, then B can be viewed as a subalgebra of A. This function returns this subalgebra.

      gap> A:= FullMatrixAlgebra( Rationals, 2 );;
      gap> V:= VectorSpace( Rationals, [ IdentityMat( 2 ) ] );;
      gap> B:= AsAlgebra( Rationals, V );;
      gap> BA:= AsSubalgebra( A, B );
      <algebra of dimension 1 over Rationals>

- `AsSubalgebraWithOne(` A`,` B`) O`

  If B is an algebra with one, all elements of which happen to be contained in the algebra with one A, then B can be viewed as a subalgebra with one of A. This function returns this subalgebra with one.

      gap> A:= FullMatrixAlgebra( Rationals, 2 );;
      gap> V:= VectorSpace( Rationals, [ IdentityMat( 2 ) ] );;
      gap> B:= AsAlgebra( Rationals, V );;
      gap> C:= AsAlgebraWithOne( Rationals, B );;
      gap> AC:= AsSubalgebraWithOne( A, C );
      <algebra-with-one over Rationals, with 1 generators>

- `MutableBasisOfClosureUnderAction(` F`,` Agens`,` from`,` init`,` opr`,` zero`,` maxdim`) F`

  Let F be a ring, Agens a list of generators for an F-algebra A, and from one of `"left"`, `"right"`, `"both"`; (this means that elements of A act via multiplication from the respective side(s).) init must be a list of initial generating vectors, and opr the operation (a function of two arguments).

  `MutableBasisOfClosureUnderAction` returns a mutable basis of the F-free left module generated by the vectors in init and their images under the action of Agens from the respective side(s).

  zero is the zero element of the desired module. maxdim is an upper bound for the dimension of the closure; if no such upper bound is known then the value of maxdim must be `infinity`.

  `MutableBasisOfClosureUnderAction` can be used to compute a basis of an associative algebra generated by the elements in Agens. In this case from may be `"left"` or `"right"`, opr is the multiplication `*`, and init is a list containing either the identity of the algebra or a list of algebra generators. (Note that if the algebra has an identity then it is in general not sufficient to take algebra-with-one generators as init, whereas of course Agens need not contain the identity.)

  (Note that bases of not necessarily associative algebras can be computed using `MutableBasisOfNonassociativeAlgebra`.)

  Other applications of `MutableBasisOfClosureUnderAction` are the computations of bases for (left/ right/ two-sided) ideals I in an associative algebra A from ideal generators of I; in these cases Agens is a list of algebra generators of A, from denotes the appropriate side(s), init is a list of ideal generators of I, and opr is again `*`.

  (Note that bases of ideals in not necessarily associative algebras can be computed using `MutableBasisOfIdealInNonassociativeAlgebra`.)

  Finally, bases of right A-modules also can be computed using `MutableBasisOfClosureUnderAction`. The only difference to the ideal case is that init is now a list of right module generators, and opr is the operation of the module.

      gap> A:= QuaternionAlgebra( Rationals );;
      gap> g:= GeneratorsOfAlgebra( A );;
      gap> B:= MutableBasisOfClosureUnderAction( Rationals, g, "left", [ g[1] ], \*, Zero(A), 4 );
      <mutable basis over Rationals, 4 vectors>
      gap> BasisVectors( B );
      [ e, i, j, k ]

- `MutableBasisOfNonassociativeAlgebra(` F`,` Agens`,` zero`,` maxdim`) F`

  is a mutable basis of the (not necessarily associative) F-algebra that is generated by Agens, has zero element zero, and has dimension at most maxdim. If no finite bound for the dimension is known then `infinity` must be the value of maxdim.

  The difference to `MutableBasisOfClosureUnderAction` is that in general it is not sufficient to multiply just with algebra generators. (For special cases of nonassociative algebras, especially for Lie algebras, multiplying with algebra generators suffices.)

      gap> L:= FullMatrixLieAlgebra( Rationals, 4 );;
      gap> m1:= Random( L );;
      gap> m2:= Random( L );;
      gap> MutableBasisOfNonassociativeAlgebra( Rationals, [ m1, m2 ], Zero( L ),
      > 16 );
      <mutable basis over Rationals, 16 vectors>

- `MutableBasisOfIdealInNonassociativeAlgebra(` F`,` Vgens`,` Igens`,` zero`,` from`,` maxdim`) F`

  is a mutable basis of the ideal generated by Igens under the action of the (not necessarily associative) F-algebra with vector space generators Vgens. The zero element of the ideal is zero, from is one of `"left"`, `"right"`, `"both"` (with the same meaning as in `MutableBasisOfClosureUnderAction`), and maxdim is a known upper bound on the dimension of the ideal; if no finite bound for the dimension is known then `infinity` must be the value of maxdim.

  The difference to `MutableBasisOfClosureUnderAction` is that in general it is not sufficient to multiply just with algebra generators. (For special cases of nonassociative algebras, especially for Lie algebras, multiplying with algebra generators suffices.)

      gap> mats:= [  [[ 1, 0 ], [ 0, -1 ]], [[0,1],[0,0]] ];;
      gap> A:= Algebra( Rationals, mats );;
      gap> basA:= BasisVectors( Basis( A ) );;
      gap> B:= MutableBasisOfIdealInNonassociativeAlgebra( Rationals, basA,
      > [ mats[2] ], 0*mats[1], "both", infinity );
      <mutable basis over Rationals, 1 vectors>
      gap> BasisVectors( B );
      [ [ [ 0, 1 ], [ 0, 0 ] ] ]

- `DirectSumOfAlgebras(` A1`,` A2`) O`
- `DirectSumOfAlgebras(` list`) O`

  is the direct sum of the two algebras A1 and A2 respectively of the algebras in the list list.

  If all involved algebras are associative algebras then the result is also known to be associative. If all involved algebras are Lie algebras then the result is also known to be a Lie algebra.

  All involved algebras must have the same left acting domain.

  The default case is that the result is a structure constants algebra. If all involved algebras are matrix algebras, and either both are Lie algebras or both are associative then the result is again a matrix algebra of the appropriate type.

      gap> A:= QuaternionAlgebra( Rationals );;
      gap> DirectSumOfAlgebras( [A, A, A] );
      <algebra of dimension 12 over Rationals>

- `FullMatrixAlgebraCentralizer(` F`,` lst`) F`

  Compute the centralizer of the list of matrices in the list lst in the full matrix algebra over the ring F.

      gap> A:= QuaternionAlgebra( Rationals );;
      gap> mats:= List(BasisVectors(Basis( A ) ), x -> AdjointMatrix(Basis(A), x ));;
      gap> FullMatrixAlgebraCentralizer( Rationals, mats );
      <algebra-with-one of dimension 4 over Rationals>

- `RadicalOfAlgebra(` A`) A`

  is the maximal nilpotent ideal of A, where A is an associative algebra.

      gap> m:= [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ];;
      gap> A:= AlgebraWithOneByGenerators( Rationals, [ m ] );
      <algebra-with-one over Rationals, with 1 generators>
      gap> RadicalOfAlgebra( A );
      <algebra of dimension 2 over Rationals>

- `CentralIdempotentsOfAlgebra(` A`) A`

  For an associative algebra A, this function returns a list of central primitive idempotents such that their sum is the identity element of A. Therefore A is required to have an identity.

  (This is a synonym of `CentralIdempotentsOfSemiring`.)

      gap> A:= QuaternionAlgebra( Rationals );;
      gap> B:= DirectSumOfAlgebras( [A, A, A] );
      <algebra of dimension 12 over Rationals>
      gap> CentralIdempotentsOfAlgebra( B );
      [ v.9, v.5, v.1 ]

- `DirectSumDecomposition(` L`) A`

  This function calculates a list of ideals of the algebra L such that L is equal to their direct sum. Currently this is only implemented for semisimple associative algebras, and Lie algebras (semisimple or not).

      gap> G:= SymmetricGroup( 4 );;
      gap> A:= GroupRing( Rationals, G );
      <algebra-with-one over Rationals, with 2 generators>
      gap> dd:= DirectSumDecomposition( A );
      [ <two-sided ideal in <algebra-with-one of dimension 24 over Rationals>,
            (1 generators)>,
        <two-sided ideal in <algebra-with-one of dimension 24 over Rationals>,
            (1 generators)>,
        <two-sided ideal in <algebra-with-one of dimension 24 over Rationals>,
            (1 generators)>,
        <two-sided ideal in <algebra-with-one of dimension 24 over Rationals>,
            (1 generators)>,
        <two-sided ideal in <algebra-with-one of dimension 24 over Rationals>,
            (1 generators)> ]
      gap> List( dd, Dimension );
      [ 1, 1, 4, 9, 9 ]

- `LeviMalcevDecomposition(` L`) A`

  A Levi-Malcev subalgebra of the algebra L is a semisimple subalgebra complementary to the radical of L. This function returns a list with two components. The first component is a Levi-Malcev subalgebra, the second the radical. This function is implemented for associative and Lie algebras.

      gap> m:= [ [ 1, 2, 0 ], [ 0, 1, 3 ], [ 0, 0, 1] ];;
      gap> A:= Algebra( Rationals, [ m ] );;
      gap> LeviMalcevDecomposition( A );
      [ <algebra of dimension 1 over Rationals>,
        <algebra of dimension 2 over Rationals> ]

- `Grading(` A`) A`

  Let G be an Abelian group and A an algebra. Then A is said to be graded over G if for every g Î G there is a subspace Ag of A such that Ag ·Ah Ì Ag+h for g,h Î G. In GAP 4 a grading of an algebra is a record containing the following components:

  `source`
    the Abelian group over which the algebra is graded.
  `hom_components`
    a function assigning to each element from the source a subspace of the algebra.
  `min_degree`
    in the case where the algebra is graded over the integers this is the minimum number for which `hom_components` returns a nonzero subspace.
  `max_degree`
    is analogous to `min_degree`.
  We note that there are no methods to compute a grading of an arbitrary algebra; however some algebras get a natural grading when they are constructed (see JenningsLieAlgebra, NilpotentQuotientOfFpLieAlgebra).

      gap> G:= SmallGroup(3^6, 100 );
      <pc group of size 729 with 6 generators>
      gap> L:= JenningsLieAlgebra( G );
      <Lie algebra of dimension 6 over GF(3)>
      gap> g:= Grading( L );
      rec( min_degree := 1, max_degree := 9, source := Integers,
        hom_components := function( d ) ... end )
      gap> g.hom_components( 3 );
      <vector space over GF(3), with 1 generators>
      gap> g.hom_components( 14 );
      <vector space over GF(3), with 0 generators>

  ## 60.9 Homomorphisms of Algebras

  Algebra homomorphisms are vector space homomorphisms that preserve the multiplication. So the default methods for vector space homomorphisms work, and in fact there is not much use of the fact that source and range are algebras, except that preimages and images are algebras (or even ideals) in certain cases.

- `AlgebraGeneralMappingByImages(` A`,` B`,` gens`,` imgs`) O`

  is a general mapping from the F-algebra A to the F-algebra B. This general mapping is defined by mapping the entries in the list gens (elements of A) to the entries in the list imgs (elements of B), and taking the F-linear and multiplicative closure.

  gens need not generate A as an F-algebra, and if the specification does not define a linear and multiplicative mapping then the result will be multivalued. Hence, in general it is not a mapping. For constructing a linear map that is not necessarily multiplicative, we refer to `LeftModuleHomomorphismByImages` (leftmodulehomomorphismbyimages).

      gap> A:= QuaternionAlgebra( Rationals );;
      gap> B:= FullMatrixAlgebra( Rationals, 2 );;
      gap> bA:= BasisVectors( Basis( A ) );; bB:= BasisVectors( Basis( B ) );;
      gap> f:= AlgebraGeneralMappingByImages( A, B, bA, bB );
      [ e, i, j, k ] -> [ [ [ 1, 0 ], [ 0, 0 ] ], [ [ 0, 1 ], [ 0, 0 ] ],
        [ [ 0, 0 ], [ 1, 0 ] ], [ [ 0, 0 ], [ 0, 1 ] ] ]
      gap> Images( f, bA[1] );
      <add. coset of <algebra over Rationals, with 60 generators>>

- `AlgebraHomomorphismByImages(` A`,` B`,` gens`,` imgs`) F`

  `AlgebraHomomorphismByImages` returns the algebra homomorphism with source A and range B that is defined by mapping the list gens of generators of A to the list imgs of images in B.

  If gens does not generate A or if the homomorphism does not exist (i.e., if mapping the generators describes only a multi-valued mapping) then `fail` is returned.

  One can avoid the checks by calling `AlgebraHomomorphismByImagesNC`, and one can construct multi-valued mappings with `AlgebraGeneralMappingByImages`.

      gap> T:= EmptySCTable( 2, 0 );;
      gap> SetEntrySCTable( T, 1, 1, [1,1] ); SetEntrySCTable( T, 2, 2, [1,2] );
      gap> A:= AlgebraByStructureConstants( Rationals, T );;
      gap> m1:= NullMat( 2, 2 );; m1[1][1]:= 1;;
      gap> m2:= NullMat( 2, 2 );; m2[2][2]:= 1;;
      gap> B:= AlgebraByGenerators( Rationals, [ m1, m2 ] );;
      gap> bA:= BasisVectors( Basis( A ) );; bB:= BasisVectors( Basis( B ) );;
      gap> f:= AlgebraHomomorphismByImages( A, B, bA, bB );
      [ v.1, v.2 ] -> [ [ [ 1, 0 ], [ 0, 0 ] ], [ [ 0, 0 ], [ 0, 1 ] ] ]
      gap> Image( f, bA[1]+bA[2] );
      [ [ 1, 0 ], [ 0, 1 ] ]

- `AlgebraHomomorphismByImagesNC(` A`,` B`,` gens`,` imgs`) O`

  `AlgebraHomomorphismByImagesNC` is the operation that is called by the function `AlgebraHomomorphismByImages`. Its methods may assume that gens generates A and that the mapping of gens to imgs defines an algebra homomorphism. Results are unpredictable if these conditions do not hold.

  For creating a possibly multi-valued mapping from A to B that respects addition, multiplication, and scalar multiplication, `AlgebraGeneralMappingByImages` can be used.

  For the definitions of the algebras `A` and `B` in the next example we refer to the previous example.

      gap> f:= AlgebraHomomorphismByImagesNC( A, B, bA, bB );
      [ v.1, v.2 ] -> [ [ [ 1, 0 ], [ 0, 0 ] ], [ [ 0, 0 ], [ 0, 1 ] ] ]

- `AlgebraWithOneGeneralMappingByImages(` A`,` B`,` gens`,` imgs`) O`

  This function is analogous to AlgebraGeneralMappingByImages; the only difference being that the identity of A is automatically mapped to the identity of B.

      gap> A:= QuaternionAlgebra( Rationals );;
      gap> B:= FullMatrixAlgebra( Rationals, 2 );;
      gap> bA:= BasisVectors( Basis( A ) );; bB:= BasisVectors( Basis( B ) );;
      gap> f:= AlgebraWithOneGeneralMappingByImages(A,B,bA{[2,3,4]},bB{[1,2,3]});
      [ i, j, k, e ] -> [ [ [ 1, 0 ], [ 0, 0 ] ], [ [ 0, 1 ], [ 0, 0 ] ],
        [ [ 0, 0 ], [ 1, 0 ] ], [ [ 1, 0 ], [ 0, 1 ] ] ]

- `AlgebraWithOneHomomorphismByImages(` A`,` B`,` gens`,` imgs`) F`

  `AlgebraWithOneHomomorphismByImages` returns the algebra-with-one homomorphism with source A and range B that is defined by mapping the list gens of generators of A to the list imgs of images in B.

  The difference between an algebra homomorphism and an algebra-with-one homomorphism is that in the latter case, it is assumed that the identity of A is mapped to the identity of B, and therefore gens needs to generate A only as an algebra-with-one.

  If gens does not generate A or if the homomorphism does not exist (i.e., if mapping the generators describes only a multi-valued mapping) then `fail` is returned.

  One can avoid the checks by calling `AlgebraWithOneHomomorphismByImagesNC`, and one can construct multi-valued mappings with `AlgebraWithOneGeneralMappingByImages`.

      gap> m1:= NullMat( 2, 2 );; m1[1][1]:=1;;
      gap> m2:= NullMat( 2, 2 );; m2[2][2]:=1;;
      gap> A:= AlgebraByGenerators( Rationals, [m1,m2] );;
      gap> T:= EmptySCTable( 2, 0 );;
      gap> SetEntrySCTable( T, 1, 1, [1,1] );
      gap> SetEntrySCTable( T, 2, 2, [1,2] );
      gap> B:= AlgebraByStructureConstants(Rationals, T);;
      gap> bA:= BasisVectors( Basis( A ) );; bB:= BasisVectors( Basis( B ) );;
      gap> f:= AlgebraWithOneHomomorphismByImages( A, B, bA{[1]}, bB{[1]} );
      [ [ [ 1, 0 ], [ 0, 0 ] ], [ [ 1, 0 ], [ 0, 1 ] ] ] -> [ v.1, v.1+v.2 ]

- `AlgebraWithOneHomomorphismByImagesNC(` A`,` B`,` gens`,` imgs`) O`

  `AlgebraWithOneHomomorphismByImagesNC` is the operation that is called by the function `AlgebraWithOneHomomorphismByImages`. Its methods may assume that gens generates A and that the mapping of gens to imgs defines an algebra-with-one homomorphism. Results are unpredictable if these conditions do not hold.

  For creating a possibly multi-valued mapping from A to B that respects addition, multiplication, identity, and scalar multiplication, `AlgebraWithOneGeneralMappingByImages` can be used.

      gap> m1:= NullMat( 2, 2 );; m1[1][1]:=1;;
      gap> m2:= NullMat( 2, 2 );; m2[2][2]:=1;;
      gap> A:= AlgebraByGenerators( Rationals, [m1,m2] );;
      gap> T:= EmptySCTable( 2, 0 );;
      gap> SetEntrySCTable( T, 1, 1, [1,1] );
      gap> SetEntrySCTable( T, 2, 2, [1,2] );
      gap> B:= AlgebraByStructureConstants( Rationals, T);;
      gap> bA:= BasisVectors( Basis( A ) );; bB:= BasisVectors( Basis( B ) );;
      gap> f:= AlgebraWithOneHomomorphismByImagesNC( A, B, bA{[1]}, bB{[1]} );
      [ [ [ 1, 0 ], [ 0, 0 ] ], [ [ 1, 0 ], [ 0, 1 ] ] ] -> [ v.1, v.1+v.2 ]

- `NaturalHomomorphismByIdeal(` A`,` I`) O`

  is the homomorphism of algebras provided by the natural projection map of A onto the quotient algebra A/I. This map can be used to take pre-images in the original algebra from elements in the quotient.

      gap> L:= FullMatrixLieAlgebra( Rationals, 3 );;
      gap> C:= LieCentre( L );
      <two-sided ideal in <Lie algebra of dimension 9 over Rationals>, (dimension 1
       )>
      gap> hom:= NaturalHomomorphismByIdeal( L, C );
      <linear mapping by matrix, <Lie algebra of dimension
      9 over Rationals> -> <Lie algebra of dimension 8 over Rationals>>
      gap> ImagesSource( hom );
      <Lie algebra of dimension 8 over Rationals>

- `OperationAlgebraHomomorphism(` A`,` B`[,` opr`] ) O`
- `OperationAlgebraHomomorphism(` A`,` V`[,` opr`] ) O`

  `OperationAlgebraHomomorphism` returns an algebra homomorphism from the F-algebra A into a matrix algebra over F that describes the F-linear action of A on the basis B of a free left module respectively on the free left module V (in which case some basis of V is chosen), via the operation opr.

  The homomorphism need not be surjective. The default value for opr is `OnRight`.

  If A is an algebra-with-one then the operation homomorphism is an algebra-with-one homomorphism because the identity of A must act as the identity.

      gap> m1:= NullMat( 2, 2 );; m1[1][1]:= 1;;
      gap> m2:= NullMat( 2, 2 );; m2[2][2]:= 1;;
      gap> B:= AlgebraByGenerators( Rationals, [ m1, m2 ] );;
      gap> V:= FullRowSpace( Rationals, 2 );
      ( Rationals^2 )
      gap> f:=OperationAlgebraHomomorphism( B, Basis( V ), OnRight );
      <op. hom. Algebra( Rationals,
      [ [ [ 1, 0 ], [ 0, 0 ] ], [ [ 0, 0 ], [ 0, 1 ] ] ] ) -> matrices of dim. 2>
      gap> Image( f, m1 );
      [ [ 1, 0 ], [ 0, 0 ] ]

- `IsomorphismFpAlgebra(` A`) A`

  isomorphism from the algebra A onto a finitely presented algebra.

      gap> A:= QuaternionAlgebra( Rationals );
      <algebra-with-one of dimension 4 over Rationals>
      gap> f:= IsomorphismFpAlgebra( A );
      [ e, i, j, k, e ] -> [ [(1)*x.1], [(1)*x.2], [(1)*x.3], [(1)*x.4],
        [(1)*<identity ...>] ]

- `IsomorphismMatrixAlgebra(` A`) A`

  isomorphism from the algebra A onto a matrix algebra. Currently this is only implemented for associative algebras with one.

      gap> T:= EmptySCTable( 2, 0 );;
      gap> SetEntrySCTable( T, 1, 1, [1,1] ); SetEntrySCTable( T, 2, 2, [1,2] );
      gap> A:= AlgebraByStructureConstants( Rationals, T );;
      gap> A:= AsAlgebraWithOne( Rationals, A );;
      gap> f:=IsomorphismMatrixAlgebra( A );
      <op. hom. AlgebraWithOne( Rationals, ... ) -> matrices of dim. 2>
      gap> Image( f, BasisVectors( Basis( A ) )[1] );
      [ [ 1, 0 ], [ 0, 0 ] ]

- `IsomorphismSCAlgebra(` B`) A`
- `IsomorphismSCAlgebra(` A`) A`

  For a basis B of an algebra A, say, `IsomorphismSCAlgebra` returns an algebra isomorphism from A to an algebra S given by structure constants (see Constructing Algebras by Structure Constants), such that the canonical basis of S is the image of B.

  For an algebra A, `IsomorphismSCAlgebra` chooses a basis of A and returns the `IsomorphismSCAlgebra` value for that basis.

      gap> IsomorphismSCAlgebra( GF(8) );
      CanonicalBasis( GF(2^3) ) -> CanonicalBasis( <algebra of dimension 3 over GF(
      2)> )
      gap> IsomorphismSCAlgebra( GF(2)^[2,2] );
      CanonicalBasis( ( GF(2)^[ 2, 2 ] ) ) -> CanonicalBasis( <algebra of dimension
      4 over GF(2)> )

- `RepresentativeLinearOperation(` A`,` v`,` w`,` opr`) O`

  is an element of the algebra A that maps the vector v to the vector w under the linear operation described by the function opr. If no such element exists then `fail` is returned.

      gap> m1:= NullMat( 2, 2 );; m1[1][1]:= 1;;
      gap> m2:= NullMat( 2, 2 );; m2[2][2]:= 1;;
      gap> B:= AlgebraByGenerators( Rationals, [ m1, m2 ] );;
      gap> RepresentativeLinearOperation( B, [1,0], [1,0], OnRight );
      [ [ 1, 0 ], [ 0, 0 ] ]
      gap> RepresentativeLinearOperation( B, [1,0], [0,1], OnRight );
      fail

  ## 60.10 Representations of Algebras

  An algebra module is a vector space together with an action of an algebra. So a module over an algebra is constructed by giving generators of a vector space, and a function for calculating the action of algebra elements on elements of the vector space. When creating an algebra module, the generators of the vector space are wrapped up and given the category `IsLeftAlgebraModuleElement` or `IsRightModuleElement` if the algebra acts from the left, or right respectively. (So in the case of a bi-module the elements get both categories.) Most linear algebra computations are delegated to the original vector space.

  The transition between the original vector space and the corresponding algebra module is handled by `ExtRepOfObj` and `ObjByExtRep`. For an element `v` of the algebra module, `ExtRepOfObj( v )` returns the underlying element of the original vector space. Furthermore, if `vec` is an element of the original vector space, and `fam` the elements family of the corresponding algebra module, then `ObjByExtRep( fam, vec )` returns the corresponding element of the algebra module. Below is an example of this.

  The action of the algebra on elements of the algebra module is constructed by using the operator `^`. If `x` is an element of an algebra `A`, and `v` an element of a left `A`-module, then `x^v` calculates the result of the action of `x` on `v`. Similarly, if `v` is an element of a right `A`-module, then `v^x` calculates the action of `x` on `v`.

- `LeftAlgebraModuleByGenerators(` A`,` op`,` gens`) O`

  Constructs the left algebra module over A generated by the list of vectors gens. The action of A is described by the function op. This must be a function of two arguments; the first argument is the algebra element, and the second argument is a vector; it outputs the result of applying the algebra element to the vector.

- `RightAlgebraModuleByGenerators(` A`,` op`,` gens`) O`

  Constructs the right algebra module over A generated by the list of vectors gens. The action of A is described by the function op. This must be a function of two arguments; the first argument is a vector, and the second argument is the algebra element; it outputs the result of applying the algebra element to the vector.

- `BiAlgebraModuleByGenerators(` A`,` B`,` opl`,` opr`,` gens`) O`

  Constructs the algebra bi-module over A and B generated by the list of vectors gens. The left action of A is described by the function opl, and the right action of B by the function opr. opl must be a function of two arguments; the first argument is the algebra element, and the second argument is a vector; it outputs the result of applying the algebra element on the left to the vector. opr must be a function of two arguments; the first argument is a vector, and the second argument is the algebra element; it outputs the result of applying the algebra element on the right to the vector.

      gap> A:= Rationals^[3,3];
      ( Rationals^[ 3, 3 ] )
      gap> V:= LeftAlgebraModuleByGenerators( A, \*, [ [ 1, 0, 0 ] ] );
      <left-module over ( Rationals^[ 3, 3 ] )>
      gap> W:= RightAlgebraModuleByGenerators( A, \*, [ [ 1, 0, 0 ] ] );
      <right-module over ( Rationals^[ 3, 3 ] )>
      gap> M:= BiAlgebraModuleByGenerators( A, A, \*, \*, [ [ 1, 0, 0 ] ] );
      <bi-module over ( Rationals^[ 3, 3 ] ) (left) and ( Rationals^
      [ 3, 3 ] ) (right)>

  In the above examples, the modules `V`, `W`, and `M` are 3-dimensional vector spaces over the rationals. The algebra `A` acts from the left on `V`, from the right on `W`, and from the left and from the right on `M`.

- `LeftAlgebraModule(` A`,` op`,` V`) O`

  Constructs the left algebra module over A with underlying space V. The action of A is described by the function op. This must be a function of two arguments; the first argument is the algebra element, and the second argument is a vector from V; it outputs the result of applying the algebra element to the vector.

- `RightAlgebraModule(` A`,` op`,` V`) O`

  Constructs the right algebra module over A with underlying space V. The action of A is described by the function op. This must be a function of two arguments; the first argument is a vector, from V and the second argument is the algebra element; it outputs the result of applying the algebra element to the vector.

- `BiAlgebraModule(` A`,` B`,` opl`,` opr`,` V`) O`

  Constructs the algebra bi-module over A and B with underlying space V. The left action of A is described by the function opl, and the right action of B by the function opr. opl must be a function of two arguments; the first argument is the algebra element, and the second argument is a vector from V; it outputs the result of applying the algebra element on the left to the vector. opr must be a function of two arguments; the first argument is a vector from V, and the second argument is the algebra element; it outputs the result of applying the algebra element on the right to the vector.

      gap> A:= Rationals^[3,3];;
      gap> V:= Rationals^3;
      ( Rationals^3 )
      gap> V:= Rationals^3;;
      gap> M:= BiAlgebraModule( A, A, \*, \*, V );
      <bi-module over ( Rationals^[ 3, 3 ] ) (left) and ( Rationals^
      [ 3, 3 ] ) (right)>
      gap> Dimension( M );
      3

- `GeneratorsOfAlgebraModule(` M`) A`

  A list of elements of M that generate M as an algebra module.

      gap> A:= Rationals^[3,3];;
      gap> V:= LeftAlgebraModuleByGenerators( A, \*, [ [ 1, 0, 0 ] ] );;
      gap> GeneratorsOfAlgebraModule( V );
      [ [ 1, 0, 0 ] ]

- `IsAlgebraModuleElement(` obj`) C`
- `IsAlgebraModuleElementCollection(` obj`) C`
- `IsAlgebraModuleElementFamily(` fam`) C`

  Category of algebra module elements. If an object has `IsAlgebraModuleElementCollection`, then it is an algebra module. If a family has `IsAlgebraModuleElementFamily`, then it is a family of algebra module elements (every algebra module has its own elements family).

- `IsLeftAlgebraModuleElement(` obj`) C`
- `IsLeftAlgebraModuleElementCollection(` obj`) C`

  Category of left algebra module elements. If an object has `IsLeftAlgebraModuleElementCollection`, then it is a left-algebra module.

- `IsRightAlgebraModuleElement(` obj`) C`
- `IsRightAlgebraModuleElementCollection(` obj`) C`

  Category of right algebra module elements. If an object has `IsRightAlgebraModuleElementCollection`, then it is a right-algebra module.

      gap> A:= Rationals^[3,3];
      ( Rationals^[ 3, 3 ] )
      gap> M:= BiAlgebraModuleByGenerators( A, A, \*, \*, [ [ 1, 0, 0 ] ] );
      <bi-module over ( Rationals^[ 3, 3 ] ) (left) and ( Rationals^
      [ 3, 3 ] ) (right)>
      gap> vv:= BasisVectors( Basis( M ) );
      [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ]
      gap> IsLeftAlgebraModuleElement( vv[1] );
      true
      gap> IsRightAlgebraModuleElement( vv[1] );
      true
      gap> vv[1] = [ 1, 0, 0 ];
      false
      gap> ExtRepOfObj( vv[1] ) = [ 1, 0, 0 ];
      true
      gap> ObjByExtRep( ElementsFamily( FamilyObj( M ) ), [ 1, 0, 0 ] ) in M;
      true
      gap> xx:= BasisVectors( Basis( A ) );;
      gap> xx[4]^vv[1];  # left action
      [ 0, 1, 0 ]
      gap> vv[1]^xx[2];  # right action
      [ 0, 1, 0 ]

- `LeftActingAlgebra(` V`) A`

  Here V is a left-algebra module; this function returns the algebra that acts from the left on V.

- `RightActingAlgebra(` V`) A`

  Here V is a right-algebra module; this function returns the algebra that acts from the right on V.

- `ActingAlgebra(` V`) O`

  Here V is an algebra module; this function returns the algebra that acts on V (this is the same as `LeftActingAlgebra(` V`)` if V is a left module, and `RightActingAlgebra(` V`)` if V is a right module; it will signal an error if V is a bi-module).

      gap> A:= Rationals^[3,3];;
      gap> M:= BiAlgebraModuleByGenerators( A, A, \*, \*, [ [ 1, 0, 0 ] ] );;
      gap> LeftActingAlgebra( M );
      ( Rationals^[ 3, 3 ] )
      gap> RightActingAlgebra( M );
      ( Rationals^[ 3, 3 ] )
      gap> V:= RightAlgebraModuleByGenerators( A, \*, [ [ 1, 0, 0 ] ] );;
      gap> ActingAlgebra( V );
      ( Rationals^[ 3, 3 ] )

- `IsBasisOfAlgebraModuleElementSpace(` B`) C`

  If a basis B lies in the category `IsBasisOfAlgebraModuleElementSpace`, then B is a basis of a subspace of an algebra module. This means that B has the record field ``B`!.delegateBasis` set. This last object is a basis of the corresponding subspace of the vector space underlying the algebra module (i.e., the vector space spanned by all `ExtRepOfObj( v )` for `v` in the algebra module).

      gap> A:= Rationals^[3,3];;
      gap> M:= BiAlgebraModuleByGenerators( A, A, \*, \*, [ [ 1, 0, 0 ] ] );;
      gap> B:= Basis( M );
      Basis( <3-dimensional bi-module over ( Rationals^
      [ 3, 3 ] ) (left) and ( Rationals^[ 3, 3 ] ) (right)>,
      [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] )
      gap> IsBasisOfAlgebraModuleElementSpace( B );
      true
      gap> B!.delegateBasis;
      SemiEchelonBasis( <vector space of dimension 3 over Rationals>,
      [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] )

- `MatrixOfAction(` B`,` x`) O`
- `MatrixOfAction(` B`,` x`,` side`) O`

  Here B is a basis of an algebra module and x is an element of the algebra that acts on this module. This function returns the matrix of the action of x with respect to B. If x acts from the left, then the coefficients of the images of the basis elements of B (under the action of x) are the columns of the output. If x acts from the right, then they are the rows of the output.

  If the module is a bi-module, then the third parameter side must be specified. This is the string `left`, or `right` depending whether x acts from the left or the right.

      gap> M:= LeftAlgebraModuleByGenerators( A, \*, [ [ 1, 0, 0 ] ] );;
      gap> x:= Basis(A)[3];
      [ [ 0, 0, 1 ], [ 0, 0, 0 ], [ 0, 0, 0 ] ]
      gap> MatrixOfAction( Basis( M ), x );
      [ [ 0, 0, 1 ], [ 0, 0, 0 ], [ 0, 0, 0 ] ]

- `SubAlgebraModule(` M`,` gens`[,` "basis"`] ) O`

  is the sub-module of the algebra module M, generated by the vectors in gens. If as an optional argument the string `basis` is added, then it is assumed that the vectors in gens form a basis of the submodule.

      gap> m1:= NullMat( 2, 2 );; m1[1][1]:= 1;;
      gap> m2:= NullMat( 2, 2 );; m2[2][2]:= 1;;
      gap> A:= Algebra( Rationals, [ m1, m2 ] );;
      gap> M:= LeftAlgebraModuleByGenerators( A, \*, [ [ 1, 0 ], [ 0, 1 ] ] );
      <left-module over <algebra over Rationals, with 2 generators>>
      gap> bb:= BasisVectors( Basis( M ) );
      [ [ 1, 0 ], [ 0, 1 ] ]
      gap> V:= SubAlgebraModule( M, [ bb[1] ] );
      <left-module over <algebra over Rationals, with 2 generators>>
      gap> Dimension( V );
      1

- `LeftModuleByHomomorphismToMatAlg(` A`,` hom`) O`

  Here A is an algebra and hom a homomorphism from A into a matrix algebra. This function returns the left A-module defined by the homomorphism hom.

- `RightModuleByHomomorphismToMatAlg(` A`,` hom`) O`

  Here A is an algebra and hom a homomorphism from A into a matrix algebra. This function returns the right A-module defined by the homomorphism hom.

  First we produce a structure constants algebra with basis elements x, y, z such that x2 = x, y2 = y, xz = z, zy = z and all other products are zero.

      gap> T:= EmptySCTable( 3, 0 );;
      gap> SetEntrySCTable( T, 1, 1, [ 1, 1 ]);
      gap> SetEntrySCTable( T, 2, 2, [ 1, 2 ]);
      gap> SetEntrySCTable( T, 1, 3, [ 1, 3 ]);
      gap> SetEntrySCTable( T, 3, 2, [ 1, 3 ]);
      gap> A:= AlgebraByStructureConstants( Rationals, T );
      <algebra of dimension 3 over Rationals>

  Now we construct an isomorphic matrix algebra.

      gap> m1:= NullMat( 2, 2 );; m1[1][1]:= 1;;
      gap> m2:= NullMat( 2, 2 );; m2[2][2]:= 1;;
      gap> m3:= NullMat( 2, 2 );; m3[1][2]:= 1;;
      gap> B:= Algebra( Rationals, [ m1, m2, m3 ] );
      <algebra over Rationals, with 3 generators>

  Finally we construct the homomorphism and the corresponding right module.

      gap> f:= AlgebraHomomorphismByImages( A, B, Basis(A), [ m1, m2, m3 ] );;
      gap> RightModuleByHomomorphismToMatAlg( A, f );
      <2-dimensional right-module over <algebra of dimension 3 over Rationals>>

- `AdjointModule(` A`) A`

  returns the A-module defined by the left action of A on itself.

      gap> m1:= NullMat( 2, 2 );; m1[1][1]:= 1;;
      gap> m2:= NullMat( 2, 2 );; m2[2][2]:= 1;;
      gap> m3:= NullMat( 2, 2 );; m3[1][2]:= 1;;
      gap> A:= Algebra( Rationals, [ m1, m2, m3 ] );
      <algebra over Rationals, with 3 generators>
      gap> V:= AdjointModule( A );
      <3-dimensional left-module over <algebra of dimension 3 over Rationals>>
      gap> v:= Basis( V )[3];
      [ [ 0, 1 ], [ 0, 0 ] ]
      gap> W:= SubAlgebraModule( V, [ v ] );
      <left-module over <algebra of dimension 3 over Rationals>>
      gap> Dimension( W );
      1

- `FaithfulModule(` A`) A`

  returns a faithful finite-dimensional left-module over the algebra A. This is only implemented for associative algebras, and for Lie algebras of characteristic 0. (It may also work for certain Lie algebras of characteristic p > 0.)

      gap> T:= EmptySCTable( 2, 0 );;
      gap> A:= AlgebraByStructureConstants( Rationals, T );
      <algebra of dimension 2 over Rationals>

  `A` is a 2-dimensional algebra where all products are zero.

      gap> V:= FaithfulModule( A );
      <3-dimensional left-module over <algebra of dimension 2 over Rationals>>
      gap> vv:= BasisVectors( Basis( V ) );
      [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ]
      gap> xx:= BasisVectors( Basis( A ) );
      [ v.1, v.2 ]
      gap> xx[1]^vv[3];
      [ 1, 0, 0 ]

- `ModuleByRestriction(` V`,` sub`) O`
- `ModuleByRestriction(` V`,` subl`,` subr`) O`

  Here V is an algebra module and sub is a subalgebra of the acting algebra of V. This function returns the module that is the restriction of V to sub. So it has the same underlying vector space as V, but the acting algebra is sub. If two subalgebras are given then V is assumed to be a bi-module, and subl a subalgebra of the algebra acting on the left, and subr a subalgebra of the algebra acting on the right.

      gap> A:= Rationals^[3,3];;
      gap> V:= LeftAlgebraModuleByGenerators( A, \*, [ [ 1, 0, 0 ] ] );;
      gap> B:= Subalgebra( A, [ Basis(A)[1] ] );
      <algebra over Rationals, with 1 generators>
      gap> W:= ModuleByRestriction( V, B );
      <3-dimensional left-module over <algebra over Rationals, with 1 generators>>

- `NaturalHomomorphismBySubAlgebraModule(` V`,` W`) O`

  Here V must be a sub-algebra module of V. This function returns the projection from V onto ``V`/`W``. It is a linear map, that is also a module homomorphism. As usual images can be formed with `Image( f, v )` and pre-images with `PreImagesRepresentative( f, u )`.

  The quotient module can also be formed by entering ``V`/`W``.

      gap> A:= Rationals^[3,3];;
      gap> B:= DirectSumOfAlgebras( A, A );
      <algebra over Rationals, with 6 generators>
      gap> T:= StructureConstantsTable( Basis( B ) );;
      gap> C:= AlgebraByStructureConstants( Rationals, T );
      <algebra of dimension 18 over Rationals>
      gap> V:= AdjointModule( C );
      <left-module over <algebra of dimension 18 over Rationals>>
      gap> W:= SubAlgebraModule( V, [ Basis(V)[1] ] );
      <left-module over <algebra of dimension 18 over Rationals>>
      gap> f:= NaturalHomomorphismBySubAlgebraModule( V, W );
      <linear mapping by matrix, <
      18-dimensional left-module over <algebra of dimension 18 over Rationals>> -> <
      9-dimensional left-module over <algebra of dimension 18 over Rationals>>>
      gap> quo:= ImagesSource( f );  # i.e., the quotient module
      <9-dimensional left-module over <algebra of dimension 18 over Rationals>>
      gap> v:= Basis( quo )[1];
      [ 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
      gap> PreImagesRepresentative( f, v );
      v.4
      gap> Basis( C )[4]^v;
      [ 1, 0, 0, 0, 0, 0, 0, 0, 0 ]

- `DirectSumOfAlgebraModules(` list`) O`
- `DirectSumOfAlgebraModules(` V`,` W`) O`

  Here list must be a list of algebra modules. This function returns the direct sum of the elements in the list (as an algebra module). The modules must be defined over the same algebras.

  In the second form is short for `DirectSumOfAlgebraModules( [` V`,` W`] )`

      gap> A:= FullMatrixAlgebra( Rationals, 3 );;
      gap> V:= BiAlgebraModuleByGenerators( A, A, \*, \*, [ [1,0,0] ] );;
      gap> W:= DirectSumOfAlgebraModules( V, V );
      <6-dimensional left-module over ( Rationals^[ 3, 3 ] )>
      gap> BasisVectors( Basis( W ) );
      [ ( [ 1, 0, 0 ] )(+)( [ 0, 0, 0 ] ), ( [ 0, 1, 0 ] )(+)( [ 0, 0, 0 ] ),
        ( [ 0, 0, 1 ] )(+)( [ 0, 0, 0 ] ), ( [ 0, 0, 0 ] )(+)( [ 1, 0, 0 ] ),
        ( [ 0, 0, 0 ] )(+)( [ 0, 1, 0 ] ), ( [ 0, 0, 0 ] )(+)( [ 0, 0, 1 ] ) ]

  [Top] [Up] [Previous] [Next] [Index]

  GAP 4 manual
  May 2002