Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Bib Ind
[Top of Book] [Contents] [Previous Chapter] [Next Chapter]

[MathJax on]

62 Algebras
62.1 InfoAlgebra (Info Class)
62.1-1 InfoAlgebra
62.2 Constructing Algebras by Generators
62.2-1 Algebra
62.2-2 AlgebraWithOne
62.3 Constructing Algebras as Free Algebras
62.3-1 FreeAlgebra
62.3-2 FreeAlgebraWithOne
62.3-3 FreeAssociativeAlgebra
62.3-4 FreeAssociativeAlgebraWithOne
62.4 Constructing Algebras by Structure Constants
62.4-1 AlgebraByStructureConstants
62.4-2 StructureConstantsTable
62.4-3 EmptySCTable
62.4-4 SetEntrySCTable
62.4-5 GapInputSCTable
62.4-6 TestJacobi
62.4-7 IdentityFromSCTable
62.4-8 QuotientFromSCTable
62.5 Some Special Algebras
62.5-1 QuaternionAlgebra
62.5-2 ComplexificationQuat
62.5-3 OctaveAlgebra
62.5-4 FullMatrixAlgebra
62.5-5 NullAlgebra
62.6 Subalgebras
62.6-1 Subalgebra
62.6-2 SubalgebraNC
62.6-3 SubalgebraWithOne
62.6-4 SubalgebraWithOneNC
62.6-5 TrivialSubalgebra
62.7 Ideals
62.8 Categories and Properties of Algebras
62.8-1 IsFLMLOR
62.8-2 IsFLMLORWithOne
62.8-3 IsAlgebra
62.8-4 IsAlgebraWithOne
62.8-5 IsLieAlgebra
62.8-6 IsSimpleAlgebra
62.8-7 IsFiniteDimensional
62.8-8 IsQuaternion
62.9 Attributes and Operations for Algebras
62.9-1 GeneratorsOfAlgebra
62.9-2 GeneratorsOfAlgebraWithOne
62.9-3 ProductSpace
62.9-4 PowerSubalgebraSeries
62.9-5 AdjointBasis
62.9-6 IndicesOfAdjointBasis
62.9-7 AsAlgebra
62.9-8 AsAlgebraWithOne
62.9-9 AsSubalgebra
62.9-10 AsSubalgebraWithOne
62.9-11 MutableBasisOfClosureUnderAction
62.9-12 MutableBasisOfNonassociativeAlgebra
62.9-13 MutableBasisOfIdealInNonassociativeAlgebra
62.9-14 DirectSumOfAlgebras
62.9-15 FullMatrixAlgebraCentralizer
62.9-16 RadicalOfAlgebra
62.9-17 CentralIdempotentsOfAlgebra
62.9-18 DirectSumDecomposition
62.9-19 LeviMalcevDecomposition
62.9-20 Grading
62.10 Homomorphisms of Algebras
62.10-1 AlgebraGeneralMappingByImages
62.10-2 AlgebraHomomorphismByImages
62.10-3 AlgebraHomomorphismByImagesNC
62.10-4 AlgebraWithOneGeneralMappingByImages
62.10-5 AlgebraWithOneHomomorphismByImages
62.10-6 AlgebraWithOneHomomorphismByImagesNC
62.10-7 NaturalHomomorphismByIdeal
62.10-8 OperationAlgebraHomomorphism
62.10-9 NiceAlgebraMonomorphism
62.10-10 IsomorphismFpAlgebra
62.10-11 IsomorphismMatrixAlgebra
62.10-12 IsomorphismSCAlgebra
62.10-13 RepresentativeLinearOperation
62.11 Representations of Algebras
62.11-1 LeftAlgebraModuleByGenerators
62.11-2 RightAlgebraModuleByGenerators
62.11-3 BiAlgebraModuleByGenerators
62.11-4 LeftAlgebraModule
62.11-5 RightAlgebraModule
62.11-6 BiAlgebraModule
62.11-7 GeneratorsOfAlgebraModule
62.11-8 IsAlgebraModuleElement
62.11-9 IsLeftAlgebraModuleElement
62.11-10 IsRightAlgebraModuleElement
62.11-11 LeftActingAlgebra
62.11-12 RightActingAlgebra
62.11-13 ActingAlgebra
62.11-14 IsBasisOfAlgebraModuleElementSpace
62.11-15 MatrixOfAction
62.11-16 SubAlgebraModule
62.11-17 LeftModuleByHomomorphismToMatAlg
62.11-18 RightModuleByHomomorphismToMatAlg
62.11-19 AdjointModule
62.11-20 FaithfulModule
62.11-21 ModuleByRestriction
62.11-22 NaturalHomomorphismBySubAlgebraModule
62.11-23 DirectSumOfAlgebraModules
62.11-24 TranslatorSubalgebra

### 62 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 61) is also applicable to algebras.

#### 62.1 InfoAlgebra (Info Class)

##### 62.1-1 InfoAlgebra

`‣ InfoAlgebra` | ( info class )

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

#### 62.2 Constructing Algebras by Generators

##### 62.2-1 Algebra

`‣ Algebra`( F, gens[, zero][, "basis"] ) | ( function )

`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

##### 62.2-2 AlgebraWithOne

`‣ AlgebraWithOne`( F, gens[, zero][, "basis"] ) | ( function )

`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 ] ]

#### 62.3 Constructing Algebras as Free Algebras

##### 62.3-1 FreeAlgebra

`‣ FreeAlgebra`( R, rank[, name] ) | ( function )

`‣ FreeAlgebra`( R, name1, name2, ... ) | ( function )

is a free (nonassociative) algebra of rank rank over the division 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))

##### 62.3-2 FreeAlgebraWithOne

`‣ FreeAlgebraWithOne`( R, rank[, name] ) | ( function )

`‣ FreeAlgebraWithOne`( R, name1, name2, ... ) | ( function )

is a free (nonassociative) algebra-with-one of rank rank over the division 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 ...>

##### 62.3-3 FreeAssociativeAlgebra

`‣ FreeAssociativeAlgebra`( R, rank[, name] ) | ( function )

`‣ FreeAssociativeAlgebra`( R, name1, name2, ... ) | ( function )

is a free associative algebra of rank rank over the division 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>

##### 62.3-4 FreeAssociativeAlgebraWithOne

`‣ FreeAssociativeAlgebraWithOne`( R, rank[, name] ) | ( function )

`‣ FreeAssociativeAlgebraWithOne`( R, name1, name2, ... ) | ( function )

is a free associative algebra-with-one of rank rank over the division 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 ...>

#### 62.4 Constructing Algebras by Structure Constants

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

##### 62.4-1 AlgebraByStructureConstants

`‣ AlgebraByStructureConstants`( R, sctable[, nameinfo] ) | ( function )

returns a free left module A over the division ring R, with multiplication defined by the structure constants table sctable. The optional argument nameinfo can be used to prescribe names for the elements of the canonical basis of A; it can be either a string name (then name `1`, name `2` etc. are chosen) or a list of strings which are then chosen. 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

##### 62.4-2 StructureConstantsTable

`‣ StructureConstantsTable`( B ) | ( attribute )

Let B be a basis of a free left module R, say, that is also a ring. In this case `StructureConstantsTable` returns a structure constants table T in sparse representation, as used for structure constants algebras (see Section Tutorial: Algebras of the GAP User's Tutorial).

If B has length n then T is a list of length n+2. The first n entries of T are lists of length n. T[ n+1 ] is one of 1, -1, or 0; in the case of 1 the table is known to be symmetric, in the case of -1 it is known to be antisymmetric, and 0 occurs in all other cases. T[ n+2 ] is the zero element of the coefficient domain.

The coefficients w.r.t. B of the product of the i-th and j-th basis vector of B are stored in T[i][j] as a list of length 2; its first entry is the list of positions of nonzero coefficients, the second entry is the list of these coefficients themselves.

The multiplication in an algebra A with vector space basis B with basis vectors [ v_1, ..., v_n ] is determined by the so-called structure matrices M_k = [ m_ijk ]_ij, 1 ≤ k ≤ n. The M_k are defined by v_i v_j = ∑_k m_ijk v_k. Let a = [ a_1, ..., a_n ] and b = [ b_1, ..., b_n ]. Then

( ∑_i a_i v_i ) ( ∑_j b_j v_j ) = ∑_{i,j} a_i b_j ( v_i v_j ) = ∑_k ( ∑_j ( ∑_i a_i m_ijk ) b_j ) v_k = ∑_k ( a M_k b^tr ) v_k.

    gap> A:= QuaternionAlgebra( Rationals );;
    gap> StructureConstantsTable( Basis( A ) );
    [ [ [ [ 1 ], [ 1 ] ], [ [ 2 ], [ 1 ] ], [ [ 3 ], [ 1 ] ],
          [ [ 4 ], [ 1 ] ] ],
      [ [ [ 2 ], [ 1 ] ], [ [ 1 ], [ -1 ] ], [ [ 4 ], [ 1 ] ],
          [ [ 3 ], [ -1 ] ] ],
      [ [ [ 3 ], [ 1 ] ], [ [ 4 ], [ -1 ] ], [ [ 1 ], [ -1 ] ],
          [ [ 2 ], [ 1 ] ] ],
      [ [ [ 4 ], [ 1 ] ], [ [ 3 ], [ 1 ] ], [ [ 2 ], [ -1 ] ],
          [ [ 1 ], [ -1 ] ] ], 0, 0 ]

##### 62.4-3 EmptySCTable

`‣ EmptySCTable`( dim, zero[, flag] ) | ( function )

`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 flag, which must be one of the strings `"symmetric"`, `"antisymmetric"`.

For filling up the structure constants table, see `SetEntrySCTable` (62.4-4).

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

##### 62.4-4 SetEntrySCTable

`‣ SetEntrySCTable`( T, i, j, list ) | ( function )

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 [ c_ij^{k_1}, k_1, c_ij^{k_2}, k_2, ... ].

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 ]

##### 62.4-5 GapInputSCTable

`‣ GapInputSCTable`( T, varname ) | ( function )

is a string that describes the structure constants table T in terms of `EmptySCTable` (62.4-3) and `SetEntrySCTable` (62.4-4). 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] );\nSetEnt\
    rySCTable( T, 2, 1, [1,2] );\n"

##### 62.4-6 TestJacobi

`‣ TestJacobi`( T ) | ( function )

tests whether the structure constants table T satisfies the Jacobi identity v_i * (v_j * v_k) + v_j * (v_k * v_i) + v_k * (v_i * v_j) = 0 for all basis vectors v_i 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

##### 62.4-7 IdentityFromSCTable

`‣ IdentityFromSCTable`( T ) | ( function )

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 ]

##### 62.4-8 QuotientFromSCTable

`‣ QuotientFromSCTable`( T, num, den ) | ( function )

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 b_1, ..., b_n this means for num = ∑_{i = 1}^n a_i b_i, den = ∑_{i = 1}^n c_i b_i, x = ∑_{i = 1}^n x_i b_i that a_k = ∑_{i,j} c_i x_j c_ijk for all k. Here c_ijk denotes the structure constants with respect to B. This means that (as a vector) a = x M with M_jk = ∑_{i = 1}^n c_ijk c_i.

    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 ]

#### 62.5 Some Special Algebras

##### 62.5-1 QuaternionAlgebra

`‣ QuaternionAlgebra`( F[, a, b] ) | ( function )

Returns: a quaternion algebra over F, with parameters a and b.

Let F be a field or a list of field elements, let F be the field generated by F, and let a and b two elements in F. `QuaternionAlgebra` returns a quaternion algebra over F, with parameters a and b, 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` (62.9-1) and `CanonicalBasis` (61.5-3) value of an algebra constructed with `QuaternionAlgebra` is the list [ e, i, j, k ].

Two quaternion algebras with the same parameters a, b lie in the same family, so it makes sense to consider their intersection or to ask whether they are contained in each other. (This is due to the fact that the results of `QuaternionAlgebra` are cached, in the global variable `QuaternionAlgebraData`.)

The embedding of the field `GaussianRationals` (60.1-3) into a quaternion algebra A over `Rationals` (17.1-1) is not uniquely determined. One can specify one embedding 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>

##### 62.5-2 ComplexificationQuat

`‣ ComplexificationQuat`( vector ) | ( function )

`‣ ComplexificationQuat`( matrix ) | ( function )

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 = v_1 + v_2 j is a row vector over A with v_1 = e w_1 + i w_2 and v_2 = e w_3 + i w_4 then `ComplexificationQuat` called with argument v returns the concatenation of w_1 +`E(4)`w_2 and w_3 +`E(4)`w_4.

If M = M_1 + M_2 j is a matrix over A with M_1 = e N_1 + i N_2 and M_2 = e N_3 + i N_4 then `ComplexificationQuat` called with argument M returns the block matrix A over e F ⊕ i F such that A(1,1) = N_1 +`E(4)`N_2, A(2,2) = N_1 -`E(4)`N_2, A(1,2) = N_3 +`E(4)`N_4, and A(2,1) = - N_3 +`E(4)`N_4.

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

v M = v_1 M_1 + v_2 j M_1 + v_1 M_2 j + v_2 j M_2 j = ( v_1 M_1 - v_2 overline{M_2} ) + ( v_1 M_2 + v_2 overline{M_1} ) j.

##### 62.5-3 OctaveAlgebra

`‣ OctaveAlgebra`( F ) | ( function )

The algebra of octonions over F.

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

##### 62.5-4 FullMatrixAlgebra

`‣ FullMatrixAlgebra`( R, n ) | ( function )

`‣ MatrixAlgebra`( R, n ) | ( function )

`‣ MatAlgebra`( R, n ) | ( function )

is the full matrix algebra of n × n matrices over the ring R, for a nonnegative integer n.

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

##### 62.5-5 NullAlgebra

`‣ NullAlgebra`( R ) | ( attribute )

The zero-dimensional algebra over R.

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

#### 62.6 Subalgebras

##### 62.6-1 Subalgebra

`‣ Subalgebra`( A, gens[, "basis"] ) | ( function )

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>

##### 62.6-2 SubalgebraNC

`‣ SubalgebraNC`( A, gens[, "basis"] ) | ( function )

`SubalgebraNC` does the same as `Subalgebra` (62.6-1), except that 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>

##### 62.6-3 SubalgebraWithOne

`‣ SubalgebraWithOne`( A, gens[, "basis"] ) | ( function )

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

The optional third argument, the string `"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

##### 62.6-4 SubalgebraWithOneNC

`‣ SubalgebraWithOneNC`( A, gens[, "basis"] ) | ( function )

`SubalgebraWithOneNC` does the same as `SubalgebraWithOne` (62.6-3), except that it 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>

##### 62.6-5 TrivialSubalgebra

`‣ TrivialSubalgebra`( A ) | ( attribute )

The zero dimensional subalgebra of the algebra A.

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

#### 62.7 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 56. Here we give examples demonstrating the use of ideals in algebras. For an introduction into the construction of quotient algebras we refer to Chapter Tutorial: 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 ] );  # 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)>

#### 62.8 Categories and Properties of Algebras

##### 62.8-1 IsFLMLOR

`‣ IsFLMLOR`( obj ) | ( category )

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

##### 62.8-2 IsFLMLORWithOne

`‣ IsFLMLORWithOne`( obj ) | ( category )

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

##### 62.8-3 IsAlgebra

`‣ IsAlgebra`( obj ) | ( category )

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

##### 62.8-4 IsAlgebraWithOne

`‣ IsAlgebraWithOne`( obj ) | ( category )

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

##### 62.8-5 IsLieAlgebra

`‣ IsLieAlgebra`( A ) | ( property )

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 ∈A (Jacobi identity).

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

##### 62.8-6 IsSimpleAlgebra

`‣ IsSimpleAlgebra`( A ) | ( property )

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 for the case where the ground field is of characteristic zero.

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

##### 62.8-7 IsFiniteDimensional

`‣ IsFiniteDimensional`( matalg ) | ( method )

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

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

##### 62.8-8 IsQuaternion

`‣ IsQuaternion`( obj ) | ( category )

`‣ IsQuaternionCollection`( obj ) | ( category )

`‣ IsQuaternionCollColl`( obj ) | ( category )

`IsQuaternion` is the category of elements in an algebra constructed by `QuaternionAlgebra` (62.5-1). A collection of quaternions lies in the category `IsQuaternionCollection`. Finally, a collection of quaternion collections (e.g., a matrix of quaternions) 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

#### 62.9 Attributes and Operations for Algebras

##### 62.9-1 GeneratorsOfAlgebra

`‣ GeneratorsOfAlgebra`( A ) | ( attribute )

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

For a free algebra, each generator can also be accessed using the `.` operator (see `GeneratorsOfDomain` (31.9-2)).

    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 ] ] ]

##### 62.9-2 GeneratorsOfAlgebraWithOne

`‣ GeneratorsOfAlgebraWithOne`( A ) | ( attribute )

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

For a free algebra with one, each generator can also be accessed using the `.` operator (see `GeneratorsOfDomain` (31.9-2)).

    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 ] ] ]

##### 62.9-3 ProductSpace

`‣ ProductSpace`( U, V ) | ( operation )

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>

##### 62.9-4 PowerSubalgebraSeries

`‣ PowerSubalgebraSeries`( A ) | ( attribute )

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> ]

##### 62.9-5 AdjointBasis

`‣ AdjointBasis`( B ) | ( attribute )

The adjoint map ad(x) of an element x in an F-algebra A, say, is the left multiplication by x. This map is F-linear and thus, w.r.t. the given basis B= (x_1, x_2, ..., x_n) of A, ad(x) can be represented by a matrix over F. Let V denote the F-vector space of the matrices corresponding to ad(x), for x ∈ A. Then `AdjointBasis` returns the basis of V that consists of the matrices for ad(x_1), ..., ad(x_n).

    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 ]
         ] ] )

##### 62.9-6 IndicesOfAdjointBasis

`‣ IndicesOfAdjointBasis`( B ) | ( attribute )

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 x_i is a basis vector of the matrix space spanned by ad A, where x_i 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 ]

##### 62.9-7 AsAlgebra

`‣ AsAlgebra`( F, A ) | ( operation )

Returns the algebra over F generated by A.

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

##### 62.9-8 AsAlgebraWithOne

`‣ AsAlgebraWithOne`( F, A ) | ( operation )

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>

##### 62.9-9 AsSubalgebra

`‣ AsSubalgebra`( A, B ) | ( operation )

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>

##### 62.9-10 AsSubalgebraWithOne

`‣ AsSubalgebraWithOne`( A, B ) | ( operation )

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>

##### 62.9-11 MutableBasisOfClosureUnderAction

`‣ MutableBasisOfClosureUnderAction`( F, Agens, from, init, opr, zero, maxdim ) | ( function )

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` (18.2-1).

`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` (62.9-12).)

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` (62.9-13).)

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 ]

##### 62.9-12 MutableBasisOfNonassociativeAlgebra

`‣ MutableBasisOfNonassociativeAlgebra`( F, Agens, zero, maxdim ) | ( function )

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` (18.2-1) must be the value of maxdim.

The difference to `MutableBasisOfClosureUnderAction` (62.9-11) 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>

##### 62.9-13 MutableBasisOfIdealInNonassociativeAlgebra

`‣ MutableBasisOfIdealInNonassociativeAlgebra`( F, Vgens, Igens, zero, from, maxdim ) | ( function )

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` (62.9-11)), and maxdim is a known upper bound on the dimension of the ideal; if no finite bound for the dimension is known then `infinity` (18.2-1) must be the value of maxdim.

The difference to `MutableBasisOfClosureUnderAction` (62.9-11) 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 ] ] ]

##### 62.9-14 DirectSumOfAlgebras

`‣ DirectSumOfAlgebras`( A1, A2 ) | ( operation )

`‣ DirectSumOfAlgebras`( list ) | ( operation )

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>

##### 62.9-15 FullMatrixAlgebraCentralizer

`‣ FullMatrixAlgebraCentralizer`( F, lst ) | ( function )

Let lst be a nonempty list of square matrices of the same dimension n, say, with entries in the field F. `FullMatrixAlgebraCentralizer` returns the (pointwise) centralizer of all matrices in lst, inside the full matrix algebra of n × n matrices over F.

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

##### 62.9-16 RadicalOfAlgebra

`‣ RadicalOfAlgebra`( A ) | ( attribute )

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>

##### 62.9-17 CentralIdempotentsOfAlgebra

`‣ CentralIdempotentsOfAlgebra`( A ) | ( attribute )

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 ]

##### 62.9-18 DirectSumDecomposition

`‣ DirectSumDecomposition`( L ) | ( attribute )

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 for 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 ]

    gap> L:= FullMatrixLieAlgebra( Rationals, 5 );;
    gap> DirectSumDecomposition( L );
    [ <two-sided ideal in
          <two-sided ideal in <Lie algebra of dimension 25 over Rationals>
                , (dimension 1)>, (dimension 1)>,
      <two-sided ideal in
          <two-sided ideal in <Lie algebra of dimension 25 over Rationals>
                , (dimension 24)>, (dimension 24)> ]

##### 62.9-19 LeviMalcevDecomposition

`‣ LeviMalcevDecomposition`( L ) | ( attribute )

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> ]

    gap> L:= FullMatrixLieAlgebra( Rationals, 5 );;
    gap> LeviMalcevDecomposition( L );
    [ <Lie algebra of dimension 24 over Rationals>,
      <two-sided ideal in <Lie algebra of dimension 25 over Rationals>,
          (dimension 1)> ]

##### 62.9-20 Grading

`‣ Grading`( A ) | ( attribute )

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 A_g of A such that A_g ⋅ A_h ⊂ A_{g+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` (64.8-4), `NilpotentQuotientOfFpLieAlgebra` (64.11-2)).

We note also that these components may be not enough to handle the grading efficiently, and another record component may be needed. For instance in a Lie algebra L constructed by `JenningsLieAlgebra` (64.8-4), the length of the of the range `[ Grading(L)!.min_degree .. Grading(L)!.max_degree ]` may be non-polynomial in the dimension of L. To handle efficiently this situation, an optional component can be used:

`non_zero_hom_components`

  the subset of `source` for which `hom_components` returns a nonzero subspace.

    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( hom_components := function( d ) ... end, max_degree := 9,
      min_degree := 1, source := Integers )
    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>

#### 62.10 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.

##### 62.10-1 AlgebraGeneralMappingByImages

`‣ AlgebraGeneralMappingByImages`( A, B, gens, imgs ) | ( operation )

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` (61.10-2).

    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 16 generators>>

##### 62.10-2 AlgebraHomomorphismByImages

`‣ AlgebraHomomorphismByImages`( A, B, gens, imgs ) | ( function )

`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` (62.10-3), and one can construct multi-valued mappings with `AlgebraGeneralMappingByImages` (62.10-1).

    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 ] ]

##### 62.10-3 AlgebraHomomorphismByImagesNC

`‣ AlgebraHomomorphismByImagesNC`( A, B, gens, imgs ) | ( operation )

`AlgebraHomomorphismByImagesNC` is the operation that is called by the function `AlgebraHomomorphismByImages` (62.10-2). 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` (62.10-1) 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 ] ] ]

##### 62.10-4 AlgebraWithOneGeneralMappingByImages

`‣ AlgebraWithOneGeneralMappingByImages`( A, B, gens, imgs ) | ( operation )

This function is analogous to `AlgebraGeneralMappingByImages` (62.10-1); 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 ] ] ]

##### 62.10-5 AlgebraWithOneHomomorphismByImages

`‣ AlgebraWithOneHomomorphismByImages`( A, B, gens, imgs ) | ( function )

`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` (62.10-6), and one can construct multi-valued mappings with `AlgebraWithOneGeneralMappingByImages` (62.10-4).

    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 ]

##### 62.10-6 AlgebraWithOneHomomorphismByImagesNC

`‣ AlgebraWithOneHomomorphismByImagesNC`( A, B, gens, imgs ) | ( operation )

`AlgebraWithOneHomomorphismByImagesNC` is the operation that is called by the function `AlgebraWithOneHomomorphismByImages` (62.10-5). 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` (62.10-4) 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 ]

##### 62.10-7 NaturalHomomorphismByIdeal

`‣ NaturalHomomorphismByIdeal`( A, I ) | ( method )

For an algebra A and an ideal I in A, the return value of `NaturalHomomorphismByIdeal` (56.8-4) is a homomorphism of algebras, in particular the range of this mapping is also an algebra.

    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>

##### 62.10-8 OperationAlgebraHomomorphism

`‣ OperationAlgebraHomomorphism`( A, B[, opr] ) | ( operation )

`‣ OperationAlgebraHomomorphism`( A, V[, opr] ) | ( operation )

`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` (41.2-2).

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 ] ]

##### 62.10-9 NiceAlgebraMonomorphism

`‣ NiceAlgebraMonomorphism`( A ) | ( attribute )

If A is an associative algebra with one, returns an isomorphism from A onto a matrix algebra (see `IsomorphismMatrixAlgebra` (62.10-11) for an example). If A is a finitely presented Lie algebra, returns an isomorphism from A onto a Lie algebra defined by a structure constants table (see 64.11 for an example).

##### 62.10-10 IsomorphismFpAlgebra

`‣ IsomorphismFpAlgebra`( A ) | ( attribute )

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

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

##### 62.10-11 IsomorphismMatrixAlgebra

`‣ IsomorphismMatrixAlgebra`( A ) | ( attribute )

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 ] ]

##### 62.10-12 IsomorphismSCAlgebra

`‣ IsomorphismSCAlgebra`( B ) | ( attribute )

`‣ IsomorphismSCAlgebra`( A ) | ( attribute )

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 62.4), 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)> )

##### 62.10-13 RepresentativeLinearOperation

`‣ RepresentativeLinearOperation`( A, v, w, opr ) | ( operation )

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

#### 62.11 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`.

##### 62.11-1 LeftAlgebraModuleByGenerators

`‣ LeftAlgebraModuleByGenerators`( A, op, gens ) | ( operation )

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.

##### 62.11-2 RightAlgebraModuleByGenerators

`‣ RightAlgebraModuleByGenerators`( A, op, gens ) | ( operation )

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.

##### 62.11-3 BiAlgebraModuleByGenerators

`‣ BiAlgebraModuleByGenerators`( A, B, opl, opr, gens ) | ( operation )

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

##### 62.11-4 LeftAlgebraModule

`‣ LeftAlgebraModule`( A, op, V ) | ( operation )

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.

##### 62.11-5 RightAlgebraModule

`‣ RightAlgebraModule`( A, op, V ) | ( operation )

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.

##### 62.11-6 BiAlgebraModule

`‣ BiAlgebraModule`( A, B, opl, opr, V ) | ( operation )

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

##### 62.11-7 GeneratorsOfAlgebraModule

`‣ GeneratorsOfAlgebraModule`( M ) | ( attribute )

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 ] ]

##### 62.11-8 IsAlgebraModuleElement

`‣ IsAlgebraModuleElement`( obj ) | ( category )

`‣ IsAlgebraModuleElementCollection`( obj ) | ( category )

`‣ IsAlgebraModuleElementFamily`( fam ) | ( category )

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

##### 62.11-9 IsLeftAlgebraModuleElement

`‣ IsLeftAlgebraModuleElement`( obj ) | ( category )

`‣ IsLeftAlgebraModuleElementCollection`( obj ) | ( category )

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

##### 62.11-10 IsRightAlgebraModuleElement

`‣ IsRightAlgebraModuleElement`( obj ) | ( category )

`‣ IsRightAlgebraModuleElementCollection`( obj ) | ( category )

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 ]

##### 62.11-11 LeftActingAlgebra

`‣ LeftActingAlgebra`( V ) | ( attribute )

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

##### 62.11-12 RightActingAlgebra

`‣ RightActingAlgebra`( V ) | ( attribute )

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

##### 62.11-13 ActingAlgebra

`‣ ActingAlgebra`( V ) | ( operation )

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 ] )

##### 62.11-14 IsBasisOfAlgebraModuleElementSpace

`‣ IsBasisOfAlgebraModuleElementSpace`( B ) | ( category )

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 ] ] )

##### 62.11-15 MatrixOfAction

`‣ MatrixOfAction`( B, x[, side] ) | ( operation )

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 ] ]

##### 62.11-16 SubAlgebraModule

`‣ SubAlgebraModule`( M, gens[, "basis"] ) | ( operation )

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

##### 62.11-17 LeftModuleByHomomorphismToMatAlg

`‣ LeftModuleByHomomorphismToMatAlg`( A, hom ) | ( operation )

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.

##### 62.11-18 RightModuleByHomomorphismToMatAlg

`‣ RightModuleByHomomorphismToMatAlg`( A, hom ) | ( operation )

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 x^2 = x, y^2 = 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 );
    <right-module over <algebra of dimension 3 over Rationals>>

##### 62.11-19 AdjointModule

`‣ AdjointModule`( A ) | ( attribute )

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

##### 62.11-20 FaithfulModule

`‣ FaithfulModule`( A ) | ( attribute )

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>

    gap> T:= EmptySCTable( 3, 0, "antisymmetric" );;
    gap> SetEntrySCTable( T, 1, 2, [ 1, 3 ]);
    gap> L:= LieAlgebraByStructureConstants( Rationals, T );
    <Lie algebra of dimension 3 over Rationals>
    gap> V:= FaithfulModule( L );
    <left-module over <Lie algebra of dimension 3 over Rationals>>
    gap> vv:= BasisVectors( Basis( V ) );
    [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ]
    gap> x:= Basis( L )[3];
    v.3
    gap> List( vv, v -> x^v );
    [ [ 0, 0, 0 ], [ 1, 0, 0 ], [ 0, 0, 0 ] ]

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

    gap> V:= FaithfulModule( A );
    <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 ]

##### 62.11-21 ModuleByRestriction

`‣ ModuleByRestriction`( V, sub1[, sub2] ) | ( operation )

Here V is an algebra module and sub1 is a subalgebra of the acting algebra of V. This function returns the module that is the restriction of V to sub1. So it has the same underlying vector space as V, but the acting algebra is sub. If two subalgebras sub1, sub2 are given then V is assumed to be a bi-module, and sub1 a subalgebra of the algebra acting on the left, and sub2 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 );
    <left-module over <algebra over Rationals, with 1 generators>>

##### 62.11-22 NaturalHomomorphismBySubAlgebraModule

`‣ NaturalHomomorphismBySubAlgebraModule`( V, W ) | ( operation )

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 ]

##### 62.11-23 DirectSumOfAlgebraModules

`‣ DirectSumOfAlgebraModules`( list ) | ( operation )

`‣ DirectSumOfAlgebraModules`( V, W ) | ( operation )

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 ] ) ]

    gap> L:= SimpleLieAlgebra( "C", 3, Rationals );;
    gap> V:= HighestWeightModule( L, [ 1, 1, 0 ] );
    <64-dimensional left-module over <Lie algebra of dimension
    21 over Rationals>>
    gap> W:= HighestWeightModule( L, [ 0, 0, 2 ] );
    <84-dimensional left-module over <Lie algebra of dimension
    21 over Rationals>>
    gap> U:= DirectSumOfAlgebraModules( V, W );
    <148-dimensional left-module over <Lie algebra of dimension
    21 over Rationals>>

##### 62.11-24 TranslatorSubalgebra

`‣ TranslatorSubalgebra`( M, U, W ) | ( operation )

Here M is an algebra module, and U and W are two subspaces of M. Let A be the algebra acting on M. This function returns the subspace of elements of A that map U into W. If W is a sub-algebra-module (i.e., closed under the action of A), then this space is a subalgebra of A.

This function works for left, or right modules over a finite-dimensional algebra. We stress that it is not checked whether U and W are indeed subspaces of M. If this is not the case nothing is guaranteed about the behaviour of the function.

    gap> A:= FullMatrixAlgebra( Rationals, 3 );
    ( Rationals^[ 3, 3 ] )
    gap> V:= Rationals^[3,2];
    ( Rationals^[ 3, 2 ] )
    gap> M:= LeftAlgebraModule( A, \*, V );
    <left-module over ( Rationals^[ 3, 3 ] )>
    gap> bm:= Basis(M);;
    gap> U:= SubAlgebraModule( M, [ bm[1] ] );
    <left-module over ( Rationals^[ 3, 3 ] )>
    gap> TranslatorSubalgebra( M, U, M );
    <algebra of dimension 9 over Rationals>
    gap> W:= SubAlgebraModule( M, [ bm[4] ] );
    <left-module over ( Rationals^[ 3, 3 ] )>
    gap> T:=TranslatorSubalgebra( M, U, W );
    <algebra of dimension 0 over Rationals>

[Top of Book] [Contents] [Previous Chapter] [Next Chapter]
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Bib Ind

generated by GAPDoc2HTML