  
  [1X5 [33X[0;0YGeneral Functions[133X[101X
  
  [33X[0;0YSome  of  the  functions  provided by [5XHAPprime[105X are not specifically aimed at
  homological  algebra  or  extending  the  [5XHAP[105X package. The functions in this
  chapter,  which  are used internally by [5XHAPprime[105X extend some of the standard
  [5XGAP[105X functions and datatypes.[133X
  
  
  [1X5.1 [33X[0;0YMatrices[133X[101X
  
  [33X[0;0YFor  details of the standard [5XGAP[105X vector and matrix functions, see [14X'Tutorial:
  matrices'[114X  and  [14X'Reference:  Matrices'[114X  in  the  [5XGAP[105X  tutorial and reference
  manuals.  [5XHAPprime[105X provides improved versions of a couple of standard matrix
  operations, and two small helper functions.[133X
  
  [1X5.1-1 SumIntersectionMatDestructive[101X
  
  [33X[1;0Y[29X[2XSumIntersectionMatDestructive[102X( [3XU[103X, [3XV[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XSumIntersectionMatDestructiveSE[102X( [3XUbasis[103X, [3XUheads[103X, [3XVbasis[103X, [3XVheads[103X ) [32X operation[133X
  
  [33X[0;0YReturns  a  list  of  length  2  with, at the first position, the sum of the
  vector spaces generated by the rows of [3XU[103X and [3XV[103X, and, at the second position,
  the intersection of the spaces.[133X
  
  [33X[0;0YLike     the    [5XGAP[105X    core    function    [2XSumIntersectionMat[102X    ([14XReference:
  SumIntersectionMat[114X),  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  [5XGAP[105X  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.[133X
  
  [33X[0;0YThe  function  [9XSumIntersectionMatDestructiveSE[109X 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
  [2XSemiEchelonMatDestructive[102X   ([14XReference:   SemiEchelonMatDestructive[114X)  (these
  arguments must all be mutable, so [2XSemiEchelonMat[102X ([14XReference: SemiEchelonMat[114X)
  cannot    be    used).    This    function    is    used    internally    by
  [9XSumIntersectionMatDestructive[109X,  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.[133X
  
  [1X5.1-2 SolutionMat[101X
  
  [33X[1;0Y[29X[2XSolutionMat[102X( [3XM[103X, [3XV[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XSolutionMatDestructive[102X( [3XM[103X, [3XV[103X ) [32X operation[133X
  
  [33X[0;0YCalculates, for each row vector [22Xv_i[122X in the matrix [3XV[103X, a solution to [22Xx_i × M =
  v_i[122X,  and  returns these solutions in a matrix [22XX[122X, whose rows are the vectors
  [22Xx_i[122X.  If  there  is not a solution for a [22Xv_i[122X, then [9Xfail[109X is returned for that
  row.[133X
  
  [33X[0;0YThese   functions   are   identical  to  the  kernel  functions  [2XSolutionMat[102X
  ([14XReference:     SolutionMat[114X)    and    [2XSolutionMatDestructive[102X    ([14XReference:
  SolutionMatDestructive[114X), but are provided for cases where multiple solutions
  using the same matrix [3XM[103X are required. In these cases, using this function is
  far faster, since the matrix is only decomposed once.[133X
  
  [33X[0;0YThe  [10XDestructive[110X  version  corrupts  both  the  input  matrices,  while  the
  non-[10XDestructive[110X version operates on copies of these.[133X
  
  [1X5.1-3 IsSameSubspace[101X
  
  [33X[1;0Y[29X[2XIsSameSubspace[102X( [3XU[103X, [3XV[103X ) [32X operation[133X
  
  [33X[0;0YReturns  [9Xtrue[109X  if the subspaces spanned by the rows of [3XU[103X and [3XV[103X are the same,
  [9Xfalse[109X otherwise.[133X
  
  [33X[0;0YThis  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.[133X
  
  [1X5.1-4 PrintDimensionsMat[101X
  
  [33X[1;0Y[29X[2XPrintDimensionsMat[102X( [3XM[103X ) [32X operation[133X
  
  [33X[0;0YReturns  a  string  containing  the  dimensions  of the matrix [3XM[103X in the form
  [10X"mxn"[110X,  where  [9Xm[109X  is  the number of rows and [9Xn[109X the number of columns. If the
  matrix is empty, the returned string is [10X"empty"[110X.[133X
  
  
  [1X5.1-5 [33X[0;0YExample: matrices and vector spaces[133X[101X
  
  [33X[0;0Y[5XGAP[105X  uses rows of a matrix to represent basis vectors for a vector space. In
  this  example we have two matrics [22XU[122X and [22XV[122X that we suspect represent the same
  subspace.  Using  [2XSolutionMat[102X  ([14X5.1-2[114X)  we  can  see  that  [22XV[122X lies in [22XU[122X, but
  [2XIsSameSubspace[102X  ([14X5.1-3[114X)  shows  that  they  are  the  same  subspace,  as is
  confirmed by having identical sums and intersections.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XU := [[1,2,3],[4,5,6]];;[127X[104X
    [4X[25Xgap>[125X [27XV := [[3,3,3],[5,7,9]];;[127X[104X
    [4X[25Xgap>[125X [27XSolutionMat(U, V);[127X[104X
    [4X[28X[ [ -1, 1 ], [ 1, 1 ] ][128X[104X
    [4X[25Xgap>[125X [27XIsSameSubspace(U, V);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XSumIntersectionMatDestructive(U, V);[127X[104X
    [4X[28X[ [ [ 1, 2, 3 ], [ 0, 1, 2 ] ], [ [ 0, 1, 2 ], [ 1, 0, -1 ] ] ][128X[104X
    [4X[25Xgap>[125X [27XIsSameSubspace(last[1], last[2]);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XPrintDimensionsMat(V);[127X[104X
    [4X[28X"2x3"[128X[104X
  [4X[32X[104X
  
  
  [1X5.2 [33X[0;0YGroups[133X[101X
  
  [33X[0;0YSmall  groups  in  [5XGAP[105X  can  be indexed by their small groups library number
  [14X'smallgrp:  The  Small  Groups Library'[114X. An alternative indexing scheme, the
  Hall-Senior  number,  is  used by Jon Carlson to publish his cohomology ring
  calculations  at  [7Xhttp://www.math.uga.edu/~lvalero/cohointro.html[107X.  To allow
  comparison  with these results, we provide a function that converts from the
  [5XGAP[105X  small  groups  library  numbers to Hall-Senior number for the groups of
  order 8, 16, 32 and 64.[133X
  
  
  [1X5.2-1 [33X[0;0YHallSeniorNumber[133X[101X
  
  [33X[1;0Y[29X[2XHallSeniorNumber[102X( [3Xorder[103X, [3Xi[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XHallSeniorNumber[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YInteger[133X
  
  [33X[0;0YReturns the Hall-Senior number for a small group (of order 8, 16, 32 or 64).
  The  group  can  be  specified  an [3Xorder[103X, [3Xi[103X pair from the [5XGAP[105X [14X'smallgrp: The
  Small  Groups  Library'[114X library, or as a group [3XG[103X, in which case [2XIdSmallGroup[102X
  ([14Xsmallgrp: IdSmallGroup[114X) is used to identify the group.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XHallSeniorNumber(32, 5);[127X[104X
    [4X[28X20[128X[104X
    [4X[25Xgap>[125X [27XHallSeniorNumber(SmallGroup(64, 1));[127X[104X
    [4X[28X11[128X[104X
  [4X[32X[104X
  
