<Chapter Label="Theory">
<Heading>Implementation Details</Heading>    

In this chapter we describe the approach used to store the normalized
unit group of the group algebra in the library, and to reconstruct
the group <M>V(KG)</M> from the stored information.

<Section Label="Writing">
<Heading>Saving the data</Heading>

To compute the pc-presentation of the normalized unit group of 
the modular group algebra of a finite <M>p</M>-group we used the 
function <C>PcNormalizedUnitGroup</C> from the &LAGUNA; package.
It uses the algorithm descibed in <Cite Key="Bovdi" />. See the
&LAGUNA; manual <Cite Key="Laguna" /> for more details.
<P/>

When this group is computed, the main idea is to use &GAP; 
function <C>CodePcGroup</C> that returns the code for the
polycyclic generating sequence of the group, and then to create
the group from this code using the &GAP; function <C>PcGroupCode</C>. 
<P/>

The resulting code could be very long, and to compress it
we used the &GAP; function <C>HexStringInt</C> than
returns a string that represents the code with hexa-decimal 
digits (using A-F as digits 10-15). The inverse translation 
then can be performed with the &GAP; function <C>IntHexString</C>.
This allowed to save almost 20 MB of space on groups of order 128
and reduce the total size of their database to 90 MB. 
<P/>

For groups of order 128 we decided to compress the library 
with the <File>gzip</File> program, and then uncompress each file 
"on fly" when it is requested. This allowed us to reduce the size
of their part in the library from 90 to 12 MB, which is already
quite reasonable. Of course, there is some little overhead arising 
from the uncompression and subsequent translation from hexa-decimal 
notation, but it is neglectible comparatively with the total time 
of the computation of <M>V(KG)</M> from scratch.
<P/>

There is one more thing that needs to be stored together with
this code to make it sure that we will correctly identify the
underlying group <M>G</M> of the group algebra <M>KG</M> with 
its image in the pc-presentation of the normalized unit group
<M>V(KG)</M>. 
<P/>

The group <M>G</M> is extracted from the &GAP; Small Groups
Library, so it is always the same, unless its description in
the library will be changed (and it will be an important task
of &UnitLib; maintaner to update the package in this case!), 
and here we are safe from inconsistencies. 
<P/>

But the next stage is the computation of generators of the normalized
unit group <M>V(KG)</M>, and the first step is the dimension basis
of the group <M>G</M>, that can be computed using the &LAGUNA; 
function <C>DimensionBasis</C>.  To avoid the influence of possible 
changes in &GAP; or usage of random methods,
we store (in compacted form) the information about the dimension 
basis of <M>G</M> in the &UnitLib;. 
<P/>

All further procedures are implemented inside the &LAGUNA; package, 
and their result is uniquely determined and predictable.
<P/>

For most groups all information is stored in a single file. However,
this is not the case for groups of order 243, where we have about 
30 MB of data for 67 groups. For these groups we provide a solution
on the base of Web-services. The information about the dimension
basis is stored locally, while the codes for polycyclic generating
sequences are available from the &UnitLib; homepage, and the package 
will access them using the function <Ref Func="SingleHTTPRequest" BookName="IO"/>
from the <Package>IO</Package> package.
<P/>

For the reader interested in more details, the package contains
the file <File>unitlib/lib/genlib.g</File> with the 
function <C>CreatePcNormalizedUnitGroupsLibrary</C>, that creates
library files for groups of a given prime power order, and the file
<File>unitlib/lib/genpar.g</File> with the function
<C>ParCreatePcNormalizedUnitGroupsLibrary</C>, which is the
parallel version of the previous function and must be used with
the &ParGAP; package <Cite Key="ParGAP" />.

</Section>


<Section Label="Reading">
<Heading>Reading the data</Heading>

To reconstruct the normalized unit group <M>V(KG)</M> from the 
library, we need only to know the catalogue number of the 
underlying group <M>G</M> in the &GAP; Small Groups Library.
<P/>

We use the same numbering as in the &GAP; Small Group Library, 
so &UnitLib; finds the appropriate library file(s) and reads from 
it the code for the polycyclic generating sequence of <M>V(KG)</M> 
and the information about the dimension basis of <M>G</M> used 
for the computation of this code.
<P/>

Then <M>V(KG)</M> is created from the code 
using the &GAP; function <Ref Func="PcGroupCode" BookName="ref"/>. 
We also create <M>G</M> using the &GAP; Small Groups Library.
<P/>

Now to <Q>glue</Q> the group <M>V(KG)</M> with the underlying group <M>G</M>
properly, the value of the attribute <Ref Attr="DimensionBasis" BookName="LAGUNA"/> of 
<M>G</M> is set in accordance with the data retrieved from 
the library. This will guarantee the correct construction of
<Ref Attr="NaturalBijectionToPcNormalizedUnitGroup" BookName="LAGUNA"/>
and <Ref Attr="NaturalBijectionToNormalizedUnitGroup" BookName="LAGUNA"/>
by the &LAGUNA; package.
<P/>

It remains now to make only several technical steps, such as
constructing the group algebra <M>KG</M> over the appropriate
field <M>K</M>, and storing <M>KG</M> in the attribute 
<Ref Attr="UnderlyingGroupRing" BookName="LAGUNA"/> of <M>V(KG)</M> 
and <M>V(KG)</M> in the attribute 
<Ref Attr="PcNormalizedUnitGroup" BookName="LAGUNA"/> of <M>KG</M>. 

</Section>

</Chapter>