[1X5 Internal Function Reference[0X These are functions that are used internally in [5XHAPprime[0m. They should not be needed by users of the package, but may be useful to developers and are provided for completeness [1X5.1 Matrices as g-generators of a row space[0X Both [9XFpGModuleGF[0m and [9XFpGModuleHomomorphismGF[0m store a matrix whose rows are g-generators for a module vector space (the module and the homomorphism's image respectively). The internal functions listed here provide common operations for dealing with these matrices. [1X5.1-1 HAPPRIME_GActMatrixColumns[0m [2X> HAPPRIME_GActMatrixColumns( [0X[3Xg, Vt, groupAndAction[0X[2X ) _____________[0Xoperation [6XReturns:[0X The matrix that results from the applying the group action u=gv to each [13Xcolumn[0m vector in the matrix [3XBt[0m. The action is provided by the function [3Xaction[0m, and operates on blocks of size [3XactionBlockSize[0m. A set of vectors are passed as [13Xcolumns[0m of a matrix (i.e. the transpose of the normal [5XGAP[0m representation). In this way the group action is just a permutation of the rows of the matrix, which is a fast operation. If the input matrix [3XVt[0m is in a compressed matrix representation, then the returned matrix will also be in compressed matrix representation. [1X5.1-2 HAPPRIME_ExpandGeneratingRow[0m [2X> HAPPRIME_ExpandGeneratingRow( [0X[3Xgen, groupAndAction[0X[2X ) _____________[0Xoperation [6XReturns:[0X A list of the F-generators for the vector space that correspond to the single g-generator [3Xgen[0m. This space is formed by multiplying the generator by each element of the group in turn, using the group and action specified in [3XgroupAndAction[0m (see [9XHAPPRIME_ModuleGroupAndAction[0m). [1X5.1-3 HAPPRIME_ExpandGeneratingRows[0m [2X> HAPPRIME_ExpandGeneratingRows( [0X[3Xgens, groupAndAction[0X[2X ) ___________[0Xoperation [6XReturns:[0X A list of F-generators for the vector space that corresponds to the set of g-generators [3Xgens[0m. This space is formed by multiplying each generator by each element of [3XG[0m in turn, using the action specified by [3Xaction[0m with blocksize [3XactionBlockSize[0m. If the input generators are [v_1, v_2, ..., v_n] then the returned list is [g_1v_1, g_2v_1, ..., g_1v_2, g_2v_2, ..., g_|G|v_n] In other words, the form of the returned matrix is block-wise, with the expansions of each row given in turn. The returned matrix is |G| times larger than the input [3Xgens[0m This function is more efficient than repeated use of [9XHAPPRIME_ExpandGeneratingRow[0m since it uses the efficient [9XHAPPRIME_GActMatrixColumns[0m to perform the group action on the whole set of generating rows at a time. [1X5.1-4 HAPPRIME_AddGeneratingRowToSemiEchelonBasisDestructive[0m [2X> HAPPRIME_AddGeneratingRowToSemiEchelonBasisDestructive( [0X[3Xbasis, gen, groupAndAction[0X[2X ) [0Xoperation This function augments a vector space basis with another generator. It returns a record consisting of two elements: [10Xvectors[0m, a set of semi-echelon basis vectors for the vector space spanned by the sum of the input [3Xbasis[0m and all g-multiples of the generating vector [3Xgen[0m; and [10Xheads[0m, a list of the head elements, in the same format as returned by [9XSemiEchelonMat[0m. The generator [3Xgen[0m is expanded according to the group and action specified in the [3XgroupAndAction[0m record (see [9XHAPPRIME_ModuleGroupAndAction[0m). If the input [3Xbasis[0m is not zero, it is also modified by this function, to be the new basis (i.e. the same as the [10Xvectors[0m element of the returned record). [1X5.1-5 HAPPRIME_ReduceVectorDestructive[0m [2X> HAPPRIME_ReduceVectorDestructive( [0X[3Xv, basis, heads[0X[2X ) _____________[0Xoperation [6XReturns:[0X Reduces the vector [3Xv[0m (in-place) using the semi-echelon set of vectors [3Xbasis[0m with heads [3Xheads[0m (as returned by [9XSemiEchelonMat[0m). Returns [9Xtrue[0m if the vector is completely reduced to zero, or [9Xfalse[0m otherwise. [1X5.1-6 HAPPRIME_ReduceGeneratorsOfModuleBySemiEchelon[0m [2X> HAPPRIME_ReduceGeneratorsOfModuleBySemiEchelon( [0X[3Xgens, G, action[0X[2X ) [0Xoperation [2X> HAPPRIME_ReduceGeneratorsOfModuleBySemiEchelonDestructive( [0X[3Xgens, groupAndAction[0X[2X ) [0Xoperation [6XReturns:[0X A subset of the module generators [3Xgens[0m over the group with action specified in the [3XgroupAndAction[0m record (see [9XHAPPRIME_ModuleGroupAndAction[0m) that will still generate the module. This gradually expands out the module generators into an F-basis, using that F-basis to reduce the other generators, until the full vector space of the module is spanned. The generators needed to span the space are returned, and should be a small set, although not minimal. The [9XDestructive[0m version of this function will modify the input [3Xgens[0m parameter. The non-destructive version makes a copy first, so leaves the input arguments unchanged, at the expense of more memory. [1X5.1-7 HAPPRIME_ReduceGeneratorsOfModuleByLeavingOneOut[0m [2X> HAPPRIME_ReduceGeneratorsOfModuleByLeavingOneOut( [0X[3Xgens, GA[0X[2X ) ____[0Xoperation [6XReturns:[0X A subset of the module generators [3Xgens[0m over the group with action specifed in the [3XgroupAndAction[0m record (see [9XHAPPRIME_ModuleGroupAndAction[0m) that will still generate the module. This tries repeatedly leaving out generators from the list [3Xgens[0m to find a small subset that still generates the module. If the generators are from the field GF(2), this is guaranteed to be a minimal set of generators. [1X5.1-8 HAPPRIME_DisplayGeneratingRows[0m [2X> HAPPRIME_DisplayGeneratingRows( [0X[3Xgens, groupAndAction[0X[2X ) __________[0Xoperation Displays a set of g-generating rows a human-readable form. The elements of each generating vector are displayed, with each block marked by a separator (since the group action on a module vector will only permute elements within a block). This function is used by [9XDisplay[0m for both [9XFpGModuleGF[0m and [9XFpGModuleHomomorphismGF[0m. NOTE: This is currently only implemented for GF(2) [4X--------------------------- Example ----------------------------[0X [4Xgap> HAPPRIME_DisplayGeneratingRows([0X [4X> ModuleGenerators(M), HAPPRIME_ModuleGroupAndAction(M));[0X [4X[...1..11|........|.......1|........|........][0X [4X[........|........|........|.1....11|........][0X [4X[........|........|........|........|..1.1.1.][0X [4X[........|.1.1..1.|........|........|........][0X [4X[........|........|......11|........|........][0X [4X[........|........|1......1|........|........][0X [4X------------------------------------------------------------------[0X [1X5.1-9 HAPPRIME_GeneratingRowsBlockStructure[0m [2X> HAPPRIME_GeneratingRowsBlockStructure( [0X[3Xgens, groupAndAction[0X[2X ) ___[0Xoperation [6XReturns:[0X Returns a matrix detailing the block structure of a set of module generating rows. The group action on a generator permutes the vector in blocks of length [10XgroupAndActionA.actionBlockSize[0m: any block that contains non-zero elements will still contain non-zero elements after the group action; any block that is all zero will remain all zero. This operation returns a matrix giving this block structure: it has a one where the block is non-zero and zero where the block is all zero. [4X--------------------------- Example ----------------------------[0X [4Xgap> b := HAPPRIME_GeneratingRowsBlockStructure([0X [4X> ModuleGenerators(M), ModuleActionBlockSize(M));[0X [4X[ [ 1, 0, 1, 1, 1 ], [ 1, 0, 1, 1, 1 ], [ 0, 1, 1, 1, 1 ], [ 0, 0, 1, 1, 1 ] ][0X [4X------------------------------------------------------------------[0X [1X5.1-10 HAPPRIME_DisplayGeneratingRowsBlocks[0m [2X> HAPPRIME_DisplayGeneratingRowsBlocks( [0X[3Xgens, actionBlockSize[0X[2X ) ___[0Xoperation Displays a set of g-generating rows a compact human-readable form. Each generating rows can be divided into blocks of length [3XactionBlockSize[0m. The generating rows are displayed in a per-block form: a [9X*[0m where the block is non-zero and [9X.[0m where the block is all zero. This function is used by [9XDisplayBlocks[0m for both [9XFpGModuleGF[0m and [9XFpGModuleHomomorphismGF[0m. [4X--------------------------- Example ----------------------------[0X [4Xgap> HAPPRIME_DisplayGeneratingRowsBlocks([0X [4X> ModuleGenerators(M), HAPPRIME_ModuleGroupAndAction(M));[0X [4X[*.*..][0X [4X[...*.][0X [4X[....*][0X [4X[.*...][0X [4X[..*..][0X [4X[..*..] [0X [4X------------------------------------------------------------------[0X [1X5.1-11 HAPPRIME_IndependentGeneratingRows[0m [2X> HAPPRIME_IndependentGeneratingRows( [0X[3Xblocks[0X[2X ) ____________________[0Xoperation [6XReturns:[0X A list of list of row indices, where each list of indices represent a set of generating rows that are indepndent of the others (i.e. share no blocks). The input is not the set of generating rows, but the block structure of the generating rows as returned by [9XHAPPRIME_GeneratingRowsBlockStructure[0m. [4X--------------------------- Example ----------------------------[0X [4Xgap> DisplayBlocks(M);[0X [4XModule over the group ring of Group( [ f1, f2, f3 ] )[0X [4X in characteristic 2 with 6 generators in FG^5.[0X [4X[**...][0X [4X[.*...][0X [4X[.**..][0X [4X[.**..][0X [4X[...*.][0X [4X[....*][0X [4XGenerators are in minimal echelon form.[0X [4Xgap> gens := ModuleGenerators(M);;[0X [4Xgap> G := ModuleGroup(M);;[0X [4Xgap> blocks := HAPPRIME_GeneratingRowsBlockStructure(gens, G);[0X [4X[ [ 1, 1, 0, 0, 0 ], [ 0, 1, 0, 0, 0 ], [ 0, 1, 1, 0, 0 ], [ 0, 1, 1, 0, 0 ],[0X [4X [ 0, 0, 0, 1, 0 ], [ 0, 0, 0, 0, 1 ] ][0X [4Xgap> HAPPRIME_IndependentGeneratingRows(blocks);[0X [4X[ [ 1, 2, 3, 4 ], [ 5 ], [ 6 ] ][0X [4X------------------------------------------------------------------[0X [1X5.1-12 HAPPRIME_GactFGvector[0m [2X> HAPPRIME_GactFGvector( [0X[3Xg, v, MT[0X[2X ) _______________________________[0Xoperation [6XReturns:[0X The vector that is the result of the action u=gv of the group element [3Xg[0m on a module vector [3Xv[0m (according to the group multiplication table [3XMT[0m. This operation is the quickest current method for a single vector. To perform the same action on a set of vectors, it is faster to use [14X5.1-1[0m instead. [1X5.1-13 HAPPRIME_CoefficientsOfGeneratingRows[0m [2X> HAPPRIME_CoefficientsOfGeneratingRows( [0X[3Xgens, groupAndAction, v[0X[2X ) [0Xoperation [2X> HAPPRIME_CoefficientsOfGeneratingRows( [0X[3Xgens, groupAndAction, coll[0X[2X ) [0Xoperation [2X> HAPPRIME_CoefficientsOfGeneratingRowsDestructive( [0X[3Xgens, groupAndAction, v[0X[2X ) [0Xoperation [2X> HAPPRIME_CoefficientsOfGeneratingRowsDestructive( [0X[3Xgens, groupAndAction, coll[0X[2X ) [0Xoperation [2X> HAPPRIME_CoefficientsOfGeneratingRowsGF( [0X[3Xgens, groupAndAction, v[0X[2X ) [0Xoperation [2X> HAPPRIME_CoefficientsOfGeneratingRowsGF( [0X[3Xgens, groupAndAction, coll[0X[2X ) [0Xoperation [2X> HAPPRIME_CoefficientsOfGeneratingRowsGFDestructive( [0X[3Xgens, groupAndAction, v[0X[2X ) [0Xoperation [2X> HAPPRIME_CoefficientsOfGeneratingRowsGFDestructive( [0X[3Xgens, groupAndAction, coll[0X[2X ) [0Xoperation [6XReturns:[0X For a single vector [3Xv[0m, it returns a vector x giving the g- coefficients from [3Xgens[0m needed to generate [3Xv[0m, i.e. the solution to the equation x*A=v, where A is the expansion of gens. If there is no solution, [9Xfail[0m is returned. If a list of vectors, [3Xcoll[0m, then a vector is returned that lists the solution for each vector (any of which may be [9Xfail[0m). The standard forms of this function use standard linear algebra to solve for the coefficients. The [10XDestructive[0m version will corrupt both [3Xgens[0m and [3Xv[0m. The [10XGF[0m versions use the block structure of the generating rows to expand only the blocks that are needed to find the solution. If the generators are in echelon form, this can save memory, but is slower. [1X5.1-14 HAPPRIME_GenerateFromGeneratingRowsCoefficients[0m [2X> HAPPRIME_GenerateFromGeneratingRowsCoefficients( [0X[3Xgens, groupAndAction, c[0X[2X ) [0Xoperation [2X> HAPPRIME_GenerateFromGeneratingRowsCoefficients( [0X[3Xgens, groupAndAction, coll[0X[2X ) [0Xoperation [2X> HAPPRIME_GenerateFromGeneratingRowsCoefficientsGF( [0X[3Xgens, groupAndAction, c[0X[2X ) [0Xoperation [2X> HAPPRIME_GenerateFromGeneratingRowsCoefficientsGF( [0X[3Xgens, groupAndAction, coll[0X[2X ) [0Xoperation [6XReturns:[0X Generate a vector of collection of vectors as a combination of the generators [3Xgens[0m given by the coefficients [3Xc[0m, or collection of vectors. This is simply the result of multiplying the vector [3Xc[0m or matrix [3Xcoll[0m by the expansion of the generators [3Xgens[0m. The standard versions of this function use standard linear algebra. The [10XGF[0m versions only performs the expansion of necessary generating rows, and only expands by one group element at a time, so will only need at most twice the amount of memory as that to store [3Xgens[0m, which is a large saving over expanding the generators by every group element at the same time, as in a naive implementation. It may also be faster. [1X5.1-15 HAPPRIME_RemoveZeroBlocks[0m [2X> HAPPRIME_RemoveZeroBlocks( [0X[3Xgens, groupAndAction[0X[2X ) _______________[0Xoperation Removes from a set of generating vectors [3Xgens[0m (with group and action [3XgroupAndAction[0m any blocks that are zero in every generating vector. These will be unaffected by any row or expansion operation, and can be removed to save time or memory. The function [2XHAPPRIME_AddZeroBlocks[0m ([14X5.1-16[0m) can be used to replace the missing zeroes. This function requires the summed block structure of [3Xgens[0m, which is returned by [9XHAPPRIME_RemoveZeroBlocks[0m. [1X5.1-16 HAPPRIME_AddZeroBlocks[0m [2X> HAPPRIME_AddZeroBlocks( [0X[3Xgens, blockStructure, groupAndAction[0X[2X ) __[0Xoperation Adds zero blocks to a set of generating vectors [3Xgens[0m to make it have the block structure given in [3XblockStructure[0m (for a given group and action [3XgroupAndAction[0m). The generators [3Xgens[0m are modified in place, and also returned. The [3XblockStructure[0m parameter is identical to that returned by a prior call to [2XHAPPRIME_RemoveZeroBlocks[0m ([14X5.1-15[0m), which was most likely used earlier to remove zero blocks from the generators. [1X5.2 FG-modules[0X Internal helper functions for [9XFpGModuleGFs[0ms. [1X5.2-1 HAPPRIME_DirectSumForm[0m [2X> HAPPRIME_DirectSumForm( [0X[3Xcurrent, new[0X[2X ) __________________________[0Xoperation Returns a string containing the form of the generator matrix if the direct sum is formed between a module with the form [3Xcurrent[0m and a module with the form [3Xnew[0m. The direct sum is formed by placing the two module generating matrices in diagonal form. Given the form of the two generating matrices, this allows the form of the direct sum to be stated. See [2XModuleGeneratorsForm[0m ([14X4.2-16[0m) for information about form strings. [1X5.2-2 HAPPRIME_PrintModuleDescription[0m [2X> HAPPRIME_PrintModuleDescription( [0X[3XM[0X[2X ) ____________________________[0Xoperation Prints the standard description of a module [3XM[0m. This is used by [9XPrintObj[0m, [9XViewObj[0m and [9XDisplay[0m, with the use specified [1X5.2-3 HAPPRIME_ModuleGeneratorCoefficients[0m [2X> HAPPRIME_ModuleGeneratorCoefficients( [0X[3XM, elm[0X[2X ) __________________[0Xoperation [2X> HAPPRIME_ModuleGeneratorCoefficientsDestructive( [0X[3XM, elm[0X[2X ) _______[0Xoperation [2X> HAPPRIME_ModuleGeneratorCoefficients( [0X[3XM, coll[0X[2X ) _________________[0Xoperation [2X> HAPPRIME_ModuleGeneratorCoefficientsDestructive( [0X[3XM, coll[0X[2X ) ______[0Xoperation Returns the coefficients needed to make the module element [3Xelm[0m as a linear and g- combination of the module generators of the module [3XM[0m. They coefficients are returned in standard vector form, or if there is no solution then [10Xfail[0m is returned. If a list of elements is given, then a list of coefficients (or [10Xfails[0m) is returned. The [10XDestructive[0m form of this function might change the elements of of [3XM[0m or [3Xelm[0m. The non-[10XDestructive[0m version makes copies to ensure that they are not changed. [4X--------------------------- Example ----------------------------[0X [4X------------------------------------------------------------------[0X [1X5.2-4 HAPPRIME_ModuleElementFromGeneratorCoefficients[0m [2X> HAPPRIME_ModuleElementFromGeneratorCoefficients( [0X[3XM, c[0X[2X ) _________[0Xoperation [2X> HAPPRIME_ModuleElementFromGeneratorCoefficients( [0X[3XM, coll[0X[2X ) ______[0Xoperation Returns an element from the module [3XM[0m, constructed as a linear and g- sum of the module generators as specified in [3Xc[0m. If a list of coefficient vectors is given, a list of corresponding module elements is returned. [4X--------------------------- Example ----------------------------[0X [4X------------------------------------------------------------------[0X [1X5.2-5 HAPPRIME_MinimalGeneratorsVectorSpaceGeneratingRowsDestructive[0m [2X> HAPPRIME_MinimalGeneratorsVectorSpaceGeneratingRowsDestructive( [0X[3Xvgens, groupAndAction[0X[2X ) [0Xoperation Returns a module with minimal generators that is equal to the FG-module with [13Xvector space[0m basis [3Xvgens[0m and group and action as specified in [10XgroupAndAction[0m (see [9XModuleGroupAndAction[0m). The solution is computed by the module radical method, which is fast at the expense of memory. This is a helper function for [2XMinimalGeneratorsModuleRadical[0m ([14X4.2-30[0m) that is also used by [2XExtendResolutionPrimePowerGroupRadical[0m ([14X4.4-2[0m) (which knows that its module is already in vector-space form). This function will corrupt the matrix [3Xgens[0m. [1X5.2-6 HAPPRIME_IsGroupAndAction[0m [2X> HAPPRIME_IsGroupAndAction( [0X[3XR[0X[2X ) __________________________________[0Xoperation Returns [10Xtrue[0m if [3XR[0m appears to be a [10XgroupAndAction[0m record, or [10Xfalse[0m otherwise. [1X5.3 Resolutions[0X Internal helper functions for building resolutions. [1X5.3-1 HAPPRIME_WordToVector[0m [2X> HAPPRIME_WordToVector( [0X[3Xw, dim, orderG[0X[2X ) ____________________________[0Xmethod Returns the boundary map vector that corresponds to the [5XHAP[0m word vector [3Xw[0m with module ambient dimension [3Xdim[0m and group order [3XorderG[0m (assumed to be the [10XactionBlockSize[0m). For example, [10X[ [1,2],[2,3] ] = [ 0100|0010 ][0m. [1X5.3-2 HAPPRIME_VectorToWord[0m [2X> HAPPRIME_VectorToWord( [0X[3Xvec, orderG[0X[2X ) _____________________________[0Xfunction The [5XHAP[0m word format vector that corresponds to the boundary vector [3Xvec[0m with [10XactionBlockSize[0m assumed to be [3XorderG[0m. For example, [10X[ 0100|0010 ] = [ [1,2],[2,3] ][0m. [1X5.3-3 HAPPRIME_BoundaryMatrices[0m [2X> HAPPRIME_BoundaryMatrices( [0X[3XR[0X[2X ) _____________________________________[0Xmethod If [3XR[0m is a resolution which stores its boundaries as a list of matrices (e.g. one created by [5XHAPprime[0m, this list is returned. Otherwise, [10Xfail[0m is returned. Note that the first matrix in this list corresponds to the zeroth degree: for resolutions of modules, this is the generators of the module; for resolutions of groups, this is the empty matrix. The second matrix corresponds to the first degree, and so on. [1X5.3-4 HAPPRIME_AddNextResolutionBoundaryMapMatNC[0m [2X> HAPPRIME_AddNextResolutionBoundaryMapMatNC( [0X[3XR, BndMat[0X[2X ) _________[0Xoperation Returns the resolution [3XR[0m extended by one term, where that term is given by the boundary map matrix [3XBndMat[0m. If [3XBndMat[0m is not already in compressed matrix form, it will be converted into this form, and if the boundaries in [3XR[0m are not already in matrix form, they are all converted into this form. [1X5.3-5 HAPPRIMECreateResolutionWithBoundaryMapMatsNC[0m [2X> HAPPRIMECreateResolutionWithBoundaryMapMatsNC( [0X[3XR, BndMat[0X[2X ) ______[0Xoperation Returns a [5XHAP[0m resolution object for group [3XG[0m where the module homomorphisms are given by the boundary matrices in the list [3XBndMats[0m. This list is indexed with the boundary matrix for degree [13Xzero[0m as the first element. If the resolution is the resolution of a module, the module's minimal generators are this first boundary matrix, otherwise (for the resolution of a group), this should be set to be the empty matrix [10X[][0m. [1X5.4 Miscellaneous[0X Miscellaneous internal helper functions. [1X5.4-1 VersionWithSVN[0m [2X> VersionWithSVN( [0X[3X[0X[2X ) _______________________________________________[0Xfunction Returns a string giving a current version number for the HAPprime installation assuming that it is checked out from a subversion repository. This fetches the current version number from [10XPackageInfo.g[0m and appends the return of the [10Xsvnversion[0m program to this, returning the resulting composite string. [4X--------------------------- Example ----------------------------[0X [4Xgap> HAPPRIME_VersionWithSVN();[0X [4X"0.5.168M"[0X [4X------------------------------------------------------------------[0X