Goto Chapter: Top 1 2 3 4 5 6 Ind

### 5 General Functions

Some of the functions provided by HAPprime are not specifically aimed at homological algebra or extending the HAP package. The functions in this chapter, which are used internally by HAPprime extend some of the standard GAP functions and datatypes.

#### 5.1 Matrices

For details of the standard GAP vector and matrix functions, see Tutorial: matrices and Reference: Matrices in the GAP tutorial and reference manuals. HAPprime provides improved versions of a couple of standard matrix operations, and two small helper functions.

##### 5.1-1 SumIntersectionMatDestructive
 `> SumIntersectionMatDestructive`( U, V ) ( operation )
 `> SumIntersectionMatDestructiveSE`( Ubasis, Uheads, Vbasis, Vheads ) ( operation )

Returns a list of length 2 with, at the first position, the sum of the vector spaces generated by the rows of U and V, and, at the second position, the intersection of the spaces.

Like the GAP core function `SumIntersectionMat` (Reference: SumIntersectionMat), this performs Zassenhaus' algorithm to compute bases for the sum and the intersection. However, this version operates directly on the input matrices (thus corrupting them), and is rewritten to require only approximately 1.5 times the space of the original input matrices. By contrast, the original GAP version uses three times the memory of the original matrices to perform the calculation, and since it doesn't modify the input matrices will require a total of four times the space of the original matrices.

The function `SumIntersectionMatDestructiveSE` takes as arguments not a pair of generating matrices, but a pair of semi-echelon basis matrices and the corresponding head locations, such as is returned by a call to `SemiEchelonMatDestructive` (Reference: SemiEchelonMatDestructive) (these arguments must all be mutable, so `SemiEchelonMat` (Reference: SemiEchelonMat) cannot be used). This function is used internally by `SumIntersectionMatDestructive`, and is provided for the occasions when the user might already have the semi-echelon versions available, in which case a small amount of time will be saved.

##### 5.1-2 SolutionMat
 `> SolutionMat`( M, V ) ( operation )
 `> SolutionMatDestructive`( M, V ) ( operation )

Calculates, for each row vector v_i in the matrix V, a solution to x_i x M = v_i, and returns these solutions in a matrix X, whose rows are the vectors x_i. If there is not a solution for a v_i, then `fail` is returned for that row.

These functions are identical to the kernel functions `SolutionMat` (Reference: SolutionMat) and `SolutionMatDestructive` (Reference: SolutionMatDestructive), but are provided for cases where multiple solutions using the same matrix M are required. In these cases, using this function is far faster, since the matrix is only decomposed once.

The `Destructive` version corrupts both the input matrices, while the non-`Destructive` version operates on copies of these.

##### 5.1-3 IsSameSubspace
 `> IsSameSubspace`( U, V ) ( operation )

Returns `true` if the subspaces spanned by the rows of U and V are the same, `false` otherwise.

This function treats the rows of the two matrices as vectors from the same vector space (with the same basis), and tests whether the subspace spanned by the two sets of vectors is the same.

##### 5.1-4 PrintDimensionsMat
 `> PrintDimensionsMat`( M ) ( operation )

Returns a string containing the dimensions of the matrix M in the form `"mxn"`, where `m` is the number of rows and `n` the number of columns. If the matrix is empty, the returned string is `"empty"`.

##### 5.1-5 Example: matrices and vector spaces

GAP uses rows of a matrix to represent basis vectors for a vector space. In this example we have two matrics U and V that we suspect represent the same subspace. Using `SolutionMat` (5.1-2) we can see that V lies in U, but `IsSameSubspace` (5.1-3) shows that they are the same subspace, as is confirmed by having identical sums and intersections.

 ```gap> U := [[1,2,3],[4,5,6]];; gap> V := [[3,3,3],[5,7,9]];; gap> SolutionMat(U, V); [ [ -1, 1 ], [ 1, 1 ] ] gap> IsSameSubspace(U, V); true gap> SumIntersectionMatDestructive(U, V); [ [ [ 1, 2, 3 ], [ 0, 1, 2 ] ], [ [ 0, 1, 2 ], [ 1, 0, -1 ] ] ] gap> IsSameSubspace(last[1], last[2]); true gap> PrintDimensionsMat(V); "2x3" ```

#### 5.2 Groups

Small groups in GAP can be indexed by their small groups library number Reference: Small Groups. An alternative indexing scheme, the Hall-Senior number, is used by Jon Carlson to publish his cohomology ring calculations at http://www.math.uga.edu/~lvalero/cohointro.html. To allow comparison with these results, we provide a function that converts from the GAP small groups library numbers to Hall-Senior number for the groups of order 8, 16, 32 and 64.

##### 5.2-1 HallSeniorNumber
 `> HallSeniorNumber`( order, i ) ( attribute )
 `> HallSeniorNumber`( G ) ( attribute )

Returns: Integer

Returns the Hall-Senior number for a small group (of order 8, 16, 32 or 64). The group can be specified an order, i pair from the GAP Reference: Small Groups library, or as a group G, in which case `IdSmallGroup` (Reference: IdSmallGroup) is used to identify the group.

 ```gap> HallSeniorNumber(32, 5); 20 gap> HallSeniorNumber(SmallGroup(64, 1)); 11 ```
Goto Chapter: Top 1 2 3 4 5 6 Ind

generated by GAPDoc2HTML