GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
This chapter contains a few very basic functions which are needed for space1group calculations and were missing in standard &GAP;.23<Section><Heading>Matrices and Vectors</Heading>45<ManSection>6<Meth Name="SignRat" Arg="x" />7<Returns> sign of the rational number <Arg>x</Arg> (Standard &GAP;8currently only has <C>SignInt</C>).9</Returns>10</ManSection>1112<ManSection>13<Meth Name="VectorModOne" Arg="v"/>14<Returns>Rational vector of the same length with enties in <M>[0,1)</M></Returns>15<Description>16For a rational vector <Arg>v</Arg>, this returns the vector with all entries17taken "mod 1".18</Description>19</ManSection>2021<Example>22gap> SignRat((-4)/(-2));23124gap> SignRat(9/(-2));25-126gap> VectorModOne([1/10,100/9,5/6,6/5]);27[ 1/10, 1/9, 5/6, 1/5 ]28</Example>2930<ManSection>31<Meth Name="IsSquareMat" Arg="matrix"/>32<Returns>33<K>true</K> if <Arg>matrix</Arg> is a square matrix and <K>false</K> otherwise.34</Returns>35</ManSection>363738<ManSection>39<Meth Name="DimensionSquareMat" Arg="matrix"/>40<Returns>Number of lines in the matrix <Arg>matrix</Arg> if it is square and41<K>fail</K> otherwise42</Returns>43</ManSection>4445<Example>46gap> m:=[[1,2,3],[4,5,6],[9,6,12]];47[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 9, 6, 12 ] ]48gap> IsSquareMat(m);49true50gap> DimensionSquareMat(m);51352gap> DimensionSquareMat([[1,2],[1,2,3]]);53Error, Matrix is not square called from54</Example>5556Affine mappings of <M>n</M> dimensional space are often written as a57pair <M>(A,v)</M> where <M>A</M> is a linear mapping and <M>v</M> is a58vector. &GAP; represents affine mappings by <M>n+1</M> times59<M>n+1</M> matrices <M>M</M> which satisfy <M>M_{{n+1,n+1}}=1</M> and60<M>M_{{i,n+1}}=0</M> for all <M>1\leq i \leq n</M>.<P></P>6162An affine matrix acts on an <M>n</M> dimensional space which is63written as a space of <M>n+1</M> tuples with <M>n+1</M>st entry64<M>1</M>. Here we give two functions to handle these affine matrices.6566</Section>6768<Section><Heading>Affine Matrices OnRight</Heading>6970<ManSection>71<Meth Name="LinearPartOfAffineMatOnRight" Arg="mat"/>72<Returns>the linear part of the affine matrix <Arg>mat</Arg>. That73is, everything except for the last row and column.</Returns>74</ManSection>7576<ManSection>77<Meth Name="BasisChangeAffineMatOnRight" Arg="transform, mat"/>78<Returns>affine matrix with same dimensions as <Arg>mat</Arg></Returns>79<Description>80A basis change <Arg>transform</Arg> of an <M>n</M> dimensional81space induces a transformation on affine mappings on this space.82If <Arg>mat</Arg> is a affine matrix (in particular, it is83<M>(n+1)\times (n+1)</M>), this method returns the image of84<Arg>mat</Arg> under the basis transformation induced by85<Arg>transform</Arg>.86</Description>87</ManSection>8889<Example>90gap> c:=[[0,1],[1,0]];91[ [ 0, 1 ], [ 1, 0 ] ]92gap> m:=[[1/2,0,0],[0,2/3,0],[1,0,1]];93[ [ 1/2, 0, 0 ], [ 0, 2/3, 0 ], [ 1, 0, 1 ] ]94gap> BasisChangeAffineMatOnRight(c,m);95[ [ 2/3, 0, 0 ], [ 0, 1/2, 0 ], [ 0, 1, 1 ] ]96</Example>979899<ManSection>100<Meth Name="TranslationOnRightFromVector" Arg="v"/>101<Returns>Affine matrix </Returns>102<Description>103Given a vector <Arg>v</Arg> with <M>n</M> entries, this method returns a104<M>(n+1)\times (n+1)</M> matrix which corresponds to the affine translation105defined by <Arg>v</Arg>.106</Description>107</ManSection>108109<Example>110gap> m:=TranslationOnRightFromVector([1,2,3]);;111gap> Display(m);112[ [ 1, 0, 0, 0 ],113[ 0, 1, 0, 0 ],114[ 0, 0, 1, 0 ],115[ 1, 2, 3, 1 ] ]116gap> LinearPartOfAffineMatOnRight(m);117[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ]118gap> BasisChangeAffineMatOnRight([[3,2,1],[0,1,0],[0,0,1]],m);119[ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 3, 4, 4, 1 ] ]120</Example>121122</Section>123124<Section><Heading>Geometry</Heading>125126127<ManSection>128<Meth Name="GramianOfAverageScalarProductFromFiniteMatrixGroup" Arg="G"/>129<Returns>Symmetric positive definite matrix</Returns>130<Description>131For a finite matrix group <A>G</A>, the gramian matrix of the average scalar132product is returned. This is the sum over all <M>gg^t</M> with <M>g\in G</M>133(actually it is enough to take a generating set).134The group <A>G</A> is orthogonal with respect to the scalar product induced135by the returned matrix.136</Description>137</ManSection>138139<Subsection><Heading>Inequalities</Heading>140Inequalities are represented in the same way they are represented in141<Package>polymaking</Package>. The vector <M>(v_0,\ldots,v_n)</M>142represents the inequality <M>0\leq v_0+v_1 x_1+\ldots + v_n x_n</M>.143144</Subsection>145146147<ManSection>148<Meth Name="BisectorInequalityFromPointPair" Arg="v1, v2 [,gram]"/>149<Returns>vector of length <C>Length(v1)+1</C></Returns>150<Description>151Calculates the inequality defining the half-space containing <A>v1</A> such152that <C><A>v1</A>-<A>v2</A></C> is perpendicular on the bounding153hyperplane. And <C>(<A>v1</A>-<A>v2</A>)/2</C> is contained in the bounding154hyperplane.<Br/>155If the matrix <A>gram</A> is given, it is used as the gramian156matrix. Otherwiese, the standard scalar product is used. It is not checked157if <A>gram</A> is positive definite or symmetric.158</Description>159</ManSection>160161162<ManSection>163<Meth Name="WhichSideOfHyperplane" Arg="v, ineq"/>164<Meth Name="WhichSideOfHyperplaneNC" Arg="v, ineq"/>165<Returns>-1 (below) 0 (in) or 1 (above).</Returns>166<Description>167Let <A>v</A> be a vector of length <M>n</M> and <A>ineq</A> an inequality168represented by a vector of length <M>n+1</M>.169Then <C>WhichSideOfHyperplane(<A>v, ineq</A>)</C> returns 1 if <A>v</A> is170a solution of the inequality but not the equation given by <A>ineq</A>, it171returns 0 if <A>v</A> is a solution to the equation and -1 if it is not a172solution of the inequality <A>ineq</A>.173<P/>174The NC version does not test the input for correctness.175</Description>176</ManSection>177178<Example>179gap> BisectorInequalityFromPointPair([0,0],[1,0]);180[ 1, -2, 0 ]181gap> ineq:=BisectorInequalityFromPointPair([0,0],[1,0],[[5,4],[4,5]]);182[ 5, -10, -8 ]183gap> ineq{[2,3]}*[1/2,0];184-5185gap> WhichSideOfHyperplane([0,0],ineq);1861187gap> WhichSideOfHyperplane([1/2,0],ineq);1880189</Example>190191<ManSection><Meth Name="RelativePositionPointAndPolygon" Arg="point, poly"/>192<Returns>one of <C>"VERTEX", "FACET", "OUTSIDE", "INSIDE"</C></Returns>193<Description>194Let <A>poly</A> be a <K>PolymakeObject</K> and <A>point</A> a vector. If195<A>point</A> is a vertex of <A>poly</A>, the string <C>"VERTEX"</C> is196returned. If <A>point</A> lies inside <A>poly</A>, <C>"INSIDE"</C> is197returned and if it lies in a facet, <C>"FACET"</C> is returned and if198<A>point</A> does not lie inside <A>poly</A>, the function returns199<C>"OUTSIDE"</C>.200</Description>201</ManSection>202203</Section>204205206<Section><Heading>Space Groups</Heading>207208<ManSection><Attr Name="PointGroupRepresentatives" Arg="group"/>209<Meth Name="PointGroupRepresentatives" Arg="group"/>210<Returns>list of matrices</Returns>211<Description>212Given an <K>AffineCrystGroupOnLeftOrRight</K> <A>group</A>, this returns a213list of representatives of the point group of <A>group</A>. That is, a214system of representatives for the factor group modulo translations. This is215an attribute of <K>AffineCrystGroupOnLeftOrRight</K>216</Description>217</ManSection>218219</Section>220221