Goto Chapter: Top 1 2 3 Ind
Top of Book Previous Chapter Next Chapter

2 Examples
2.1 Computing the mod p group cohomology
2.2 Comparing the memory usage and speed of HAPprime and HAP's `ResolutionPrimePowerGroup` functions
2.2-1 HAPprime takes less memory to store resolutions
2.2-2 HAPprime takes less memory to compute resolutions
2.2-3 Automatic selection of the best method

### 2 Examples

#### 2.1 Computing the mod p group cohomology

Let G be a group and F be a field, and let FG be the group ring of G over F. A free FG-resolution of the ground ring is an exact sequence of module homomorphisms

... ---> M_(n+1) ---> M_n ---> M_(n-1) ---> ... ---> M_1 ---> FG --->> F

Where each M_n is a free FG-module and the image of d_n+1: M_n+1 -> M_n equals the kernel of d_n: M_n -> M_n-1 for all n > 0. The maps d_n are called boundary homomorphisms. In HAPprime we consider the case where G is a p-group and F is the prime field GF(p), and this is assumed from now on.

If we now define the Abelian group D_n to be Hom(M_n, F), the set of all homomorphisms M_n -> F, we can obtain the dual of this sequence, which will be a cochain complex of Abelian group homomorphisms

... <--- D_(n+1) <--- D_n ---> D_(n-1) <--- ... <--- D_1 <--- F <--- F

Each group D_n will be isomorphic to F^|M_n| where |M_n| is the rank of the module M_n. Unlike the resolution, this sequence will generally not be exact, but one can define the mod-p cohomology group of G at degree n to be

H^n(G, F) = ker(D_n ---> D_(n+1)) / im(D_(n-1) ---> D_n)

for all n > 0. As with the D_n, the mod-p cohomology groups will also be isomorphic to vector spaces over F. In the case where the resolution R is minimal (where each module M_n has the minimal number of generators), the dimensions of the (co)homology groups H^n(G, F) are identical to the dimensions of the resolution modules M_n. The group cohomology (and the similar group homology) is an invariant of G, and does not depend on a particular free FG-resolution.

In the general case, there are thus two stages to computing the group cohomology of G up to the nth cohomology group:

1. Compute R, a free FG-resolution for FG, with at least n+1 terms.

2. Construct the cochain complex C from R and compute the n homology groups of C

For example, to calculate the 9th mod-p cohomology group of the 134th order 64 in the GAP small groups library (which is the Sylow 2-subgroup of the Mathieu group M_12), we can use the HAPprime function `ResolutionPrimePowerGroupRadical` (3.1-1) to compute 10 terms of a free FG-resolution for G and then use HAP functions to find the rank b_9 of the cohomology group, which will be isomorphic to F^b_9. Alternatively, since `ResolutionPrimePowerGroupRadical` (3.1-1) always returns a minimal resolution, the cohomology group dimensions can be read directly from the resolution.

    gap> G := SmallGroup(64, 134);;
    gap> # First construct a FG-resolution for the group G
    gap> R := ResolutionPrimePowerGroupRadical(G, 10);
    Resolution of length 10 in characteristic 2 for <pc group of size 64 with
    6 generators> .
    No contracting homotopy available.
    A partial contracting homotopy is available.

    gap> # Convert this into a cochain complex (over the prime field with p=2)
    gap> C := HomToIntegersModP(R, 2);
    Cochain complex of length 10 in characteristic 2 .

    gap> # And get the rank of the 9th cohomology group
    gap> b9 := Cohomology(C, 9);
    55
    gap>
    gap> # Since R is a free resolution, the ranks of the cohomology groups
    gap> # are the same as the module ranks in R
    gap> ResolutionModuleRanks(R);
    [ 3, 6, 10, 15, 21, 28, 36, 45, 55, 66 ]

#### 2.2 Comparing the memory usage and speed of HAPprime and HAP's `ResolutionPrimePowerGroup` functions

For small p-groups, the group ring FG can be considered as a vector space of rank |G| with the elements of G as its basis elements. Each module M_n in a FG-resolution is also a vector space (of dimension |M_n||G|) and the boundary maps d_n can be represented as vector space homomorphisms. As a result, standard linear algebra techniques can be used to compute a minimal resolution by constructing a sequence of module homomorphisms where the kernel of one map is the image of the next, and where the modules have minimal generating sets. See Chapter HAPprime Datatypes: Resolutions in the datatypes manual for further details.

As the groups get larger, this approach becomes less feasible due to the amount of time and memory needed to store and compute the null space of large matrices. The HAP function `ResolutionPrimePowerGroup` (HAP: ResolutionPrimePowerGroup) and the HAPprime functions `ResolutionPrimePowerGroupRadical` (3.1-1) and `ResolutionPrimePowerGroupGF` (3.1-1) all use this linear algebra approach, but the HAPprime functions are optimised to save memory, allowing the computation of resolutions which are longer, or are of larger groups, than are possible using HAP alone.

##### 2.2-1 HAPprime takes less memory to store resolutions

Consider computing a resolution of a group of an arbitrary group of order 128, `G = SmallGroup(128, 844)` using HAP. Computation is performed on a dual-core Intel Core2Duo running at 2.66MHz, and the memory available to GAP is the standard initial allocation of 256Mb.

    gap> G := SmallGroup(128, 844);;
    gap> R := ResolutionPrimePowerGroup(G, 9);
    Resolution of length 9 in characteristic 2 for <pc group of size 128 with
    7 generators> .

    gap> time;
    27685
    gap> # Can we construct a resolution of length ten?
    gap> R := ResolutionPrimePowerGroup(G, 10);
    exceeded the permitted memory (`-o' command line option) at
    res := SemiEchelonMatDestructive( List( mat, ShallowCopy ) );
     called from
    SemiEchelonMat( NullspaceMat( BndMat ) ) called from
    ZGbasisOfKernel( i - 1 ) called from
    <function>( <arguments> ) called from read-eval-loop
    Entering break read-eval-print loop ...
    you can 'quit;' to quit to outer loop, or
    you can 'return;' to continue

The HAPprime function `ResolutionPrimePowerGroupRadical` (3.1-1) uses an almost identical algorithm, but stores its boundary maps more efficiently. As a result, with the same memory allowance:

    gap> G := SmallGroup(128, 844);;
    gap> R := ResolutionPrimePowerGroupRadical(G, 9);
    Resolution of length 9 in characteristic 2 for <pc group of size 128 with
    7 generators> .
    No contracting homotopy available.
    A partial contracting homotopy is available.

    gap> time;
    25321
    gap> # Can we construct a resolution of length ten?
    gap> R := ExtendResolutionPrimePowerGroupRadical(R);;
    gap> # Yes! How about eleven?
    gap> R := ExtendResolutionPrimePowerGroupRadical(R);
    Resolution of length 11 in characteristic 2 for <pc group of size 128 with
    7 generators> .
    No contracting homotopy available.
    A partial contracting homotopy is available.

    gap> ResolutionModuleRanks(R);
    [ 3, 6, 11, 19, 30, 44, 62, 85, 113, 146, 185 ]
    gap>
    gap> # But it will run out of memory if we try to go to twelve terms
    gap> R := ExtendResolutionPrimePowerGroupRadical(R);
    exceeded the permitted memory (`-o' command line option) at
    ...

The HAPprime version can compute two further terms of the resolution, which given the sizes of the additional modules represents a considerable improvement. Just representing the homomorphism d_10: (FG)^146 -> (FG)^113 as vectors requires nearly as much memory again as representing the first nine homomorphisms. To compute and store the same resolution of length 11 using `ResolutionPrimePowerGroup` (HAP: ResolutionPrimePowerGroup) would need a little over three times the memory used here by HAPprime. The time taken by both versions is very similar.

In the example above, note also the use of the HAPprime function `ExtendResolutionPrimePowerGroupRadical` (3.1-2), which makes it much easier to add terms to an existing resolution. In standard HAP, if one decides that a resolution is too short and that more terms are required, then the entire resolution must be computed again from scratch.

##### 2.2-2 HAPprime takes less memory to compute resolutions

The function `ResolutionPrimePowerGroupGF` (3.1-1) uses a new algorithm to compute the kernel of FG-module homomorphisms when FG-modules are represented using a set of G-generating vectors (see HAPprime Datatypes: FG-module homomorphisms in the datatypes reference manual). This provides a further memory saving over `ResolutionPrimePowerGroupRadical` (3.1-1), although at the cost of a much slower computation time:

    gap> G := SmallGroup(128, 844);;
    gap> R := ResolutionPrimePowerGroupGF(G, 9);
    Resolution of length 9 in characteristic 2 for <pc group of size 128 with
    7 generators> .
    No contracting homotopy available.
    A partial contracting homotopy is available.

    gap> time;
    422742
    gap> R := ExtendResolutionPrimePowerGroupGF(R);;
    gap> R := ExtendResolutionPrimePowerGroupGF(R);;
    gap> R := ExtendResolutionPrimePowerGroupGF(R);;
    gap> R := ExtendResolutionPrimePowerGroupGF(R);;
    gap> R := ExtendResolutionPrimePowerGroupGF(R);;
    gap> R := ExtendResolutionPrimePowerGroupGF(R);;
    Resolution of length 15 in characteristic 2 for <pc group of size 128 with
    7 generators> .
    No contracting homotopy available.
    A partial contracting homotopy is available.

    gap> ResolutionModuleRanks(R);
    [ 3, 6, 11, 19, 30, 44, 62, 85, 113, 146, 185, 231, 284, 344, 412 ]
    gap> # But it will run out of (the inital 256Mb) of memory at sixteen terms

Using `ResolutionPrimePowerGroupGF` (3.1-1) we can get a further four terms of the resolution. For this resolution, this represents a memory saving of a factor of five over `ResolutionPrimePowerGroupRadical` (3.1-1) and fifteen over `ResolutionPrimePowerGroup` (HAP: ResolutionPrimePowerGroup), although it does take fifteen times as long as either of those just to compute the first nine terms, and scales less well with size.

##### 2.2-3 Automatic selection of the best method

The two functions `ResolutionPrimePowerGroupRadical` (3.1-1) and `ResolutionPrimePowerGroupGF` (3.1-1) offer a trade-off between time and memory. The function `ResolutionPrimePowerGroupAutoMem` (3.1-1) automates the decision of which version to use, switching from the `Radical` to the `GF` version when it estimates that it is about to run out of available memory for the faster version. In this example, we have also increase the `InfoHAPprime` (1.6-1) info level to display progress information. At level two, the rank of each module in the resolution is displayed as it is calculated, giving an indication of progress. With this setting, the user is also notified when the `AutoMem` function switches, and the `GF` function displays a rolling estimate of its completion time (which is not shown since that output is overwritten when completed)

    gap> G := SmallGroup(128, 844);;
    gap> SetInfoLevel(InfoHAPprime, 2);
    gap> R := ResolutionPrimePowerGroupAutoMem(G, 15);
    #I  Dimension 2: rank 6
    #I  Dimension 3: rank 11
    #I  Dimension 4: rank 19
    #I  Dimension 5: rank 30
    #I  Dimension 6: rank 44
    #I  Dimension 7: rank 62
    #I  Dimension 8: rank 85
    #I  Dimension 9: rank 113
    #I  Finding kernel of homomorphism by splitting:
    #I   - Finding kernel of U
    #I   - Finding kernel of V
    #I   - Finding intersection of U and V
    #I   - Finding intersection preimages
    #I  Dimension 10: rank 146
    #I  Finding kernel of homomorphism by splitting:
    #I   - Finding kernel of U
    #I   - Finding kernel of V
    #I   - Finding intersection of U and V
    #I   - Finding intersection preimages
    #I  Dimension 11: rank 185
    #I  Finding kernel of homomorphism by splitting:
    #I   - Finding kernel of U
    #I   - Finding kernel of V
    #I   - Finding intersection of U and V
    #I   - Finding intersection preimages
    #I  Dimension 12: rank 231
    #I  Finding kernel of homomorphism by splitting:
    #I   - Finding kernel of U
    #I   - Finding kernel of V
    #I   - Finding intersection of U and V
    #I   - Finding intersection preimages
    #I  Dimension 13: rank 284
    #I  Finding kernel of homomorphism by splitting:
    #I   - Finding kernel of U
    #I   - Finding kernel of V
    #I   - Finding intersection of U and V
    #I   - Finding intersection preimages
    #I  Dimension 14: rank 344
    #I  Finding kernel of homomorphism by splitting:
    #I   - Finding kernel of U
    #I   - Finding kernel of V
    #I   - Finding intersection of U and V
    #I   - Finding intersection preimages
    #I  Dimension 15: rank 412
    Resolution of length 15 in characteristic 2 for <pc group of size 128 with
    7 generators> .
    No contracting homotopy available.
    A partial contracting homotopy is available.

    gap> StringTime(time);
    " 5:45:53.613"

Top of Book Previous Chapter Next Chapter
Goto Chapter: Top 1 2 3 Ind

generated by GAPDoc2HTML