1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>GAP (HAPcryst) - Chapter 2: Bits and Pieces</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="generator" content="GAPDoc2HTML" />
<link rel="stylesheet" type="text/css" href="manual.css" />
<script src="manual.js" type="text/javascript"></script>
<script type="text/javascript">overwriteStyle();</script>
</head>
<body class="chap2" onload="jscontent()">
<div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a> <a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
<div class="chlinkprevnexttop"> <a href="chap0.html">[Top of Book]</a> <a href="chap0.html#contents">[Contents]</a> <a href="chap1.html">[Previous Chapter]</a> <a href="chap3.html">[Next Chapter]</a> </div>
<p id="mathjaxlink" class="pcenter"><a href="chap2_mj.html">[MathJax on]</a></p>
<p><a id="X86FBE5B77C2F9442" name="X86FBE5B77C2F9442"></a></p>
<div class="ChapSects"><a href="chap2.html#X86FBE5B77C2F9442">2 <span class="Heading">Bits and Pieces</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2.html#X8019925B8294F5B4">2.1 <span class="Heading">Matrices and Vectors</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7D58A1848182EC26">2.1-1 SignRat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7C0552BA873515B9">2.1-2 VectorModOne</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7BB083A57C474F45">2.1-3 IsSquareMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X78C932A48515EF10">2.1-4 DimensionSquareMat</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2.html#X86BD4FE4871379AD">2.2 <span class="Heading">Affine Matrices OnRight</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X838946957FC75C17">2.2-1 LinearPartOfAffineMatOnRight</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X80DD4F2286D49F8D">2.2-2 BasisChangeAffineMatOnRight</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X81F3C49580958FB6">2.2-3 TranslationOnRightFromVector</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2.html#X84A0B0637F269E37">2.3 <span class="Heading">Geometry</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7A94DAE679AD73E3">2.3-1 GramianOfAverageScalarProductFromFiniteMatrixGroup</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X866942167802E036">2.3-2 <span class="Heading">Inequalities</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X80C365AA87BDDAFA">2.3-3 BisectorInequalityFromPointPair</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X8790464D86D189F4">2.3-4 WhichSideOfHyperplane</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X83392C417B311B6B">2.3-5 RelativePositionPointAndPolygon</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2.html#X7B14774981F80108">2.4 <span class="Heading">Space Groups</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7E2F20607F278B70">2.4-1 PointGroupRepresentatives</a></span>
</div></div>
</div>
<h3>2 <span class="Heading">Bits and Pieces</span></h3>
<p>This chapter contains a few very basic functions which are needed for space group calculations and were missing in standard <strong class="pkg">GAP</strong>.</p>
<p><a id="X8019925B8294F5B4" name="X8019925B8294F5B4"></a></p>
<h4>2.1 <span class="Heading">Matrices and Vectors</span></h4>
<p><a id="X7D58A1848182EC26" name="X7D58A1848182EC26"></a></p>
<h5>2.1-1 SignRat</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SignRat</code>( <var class="Arg">x</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: sign of the rational number <var class="Arg">x</var> (Standard <strong class="pkg">GAP</strong> currently only has <code class="code">SignInt</code>).</p>
<p><a id="X7C0552BA873515B9" name="X7C0552BA873515B9"></a></p>
<h5>2.1-2 VectorModOne</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ VectorModOne</code>( <var class="Arg">v</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: Rational vector of the same length with enties in <span class="SimpleMath">[0,1)</span></p>
<p>For a rational vector <var class="Arg">v</var>, this returns the vector with all entries taken "mod 1".</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">SignRat((-4)/(-2));</span>
1
<span class="GAPprompt">gap></span> <span class="GAPinput">SignRat(9/(-2));</span>
-1
<span class="GAPprompt">gap></span> <span class="GAPinput">VectorModOne([1/10,100/9,5/6,6/5]);</span>
[ 1/10, 1/9, 5/6, 1/5 ]
</pre></div>
<p><a id="X7BB083A57C474F45" name="X7BB083A57C474F45"></a></p>
<h5>2.1-3 IsSquareMat</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsSquareMat</code>( <var class="Arg">matrix</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: <code class="keyw">true</code> if <var class="Arg">matrix</var> is a square matrix and <code class="keyw">false</code> otherwise.</p>
<p><a id="X78C932A48515EF10" name="X78C932A48515EF10"></a></p>
<h5>2.1-4 DimensionSquareMat</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DimensionSquareMat</code>( <var class="Arg">matrix</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: Number of lines in the matrix <var class="Arg">matrix</var> if it is square and <code class="keyw">fail</code> otherwise</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">m:=[[1,2,3],[4,5,6],[9,6,12]];</span>
[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 9, 6, 12 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">IsSquareMat(m);</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">DimensionSquareMat(m);</span>
3
<span class="GAPprompt">gap></span> <span class="GAPinput">DimensionSquareMat([[1,2],[1,2,3]]);</span>
Error, Matrix is not square called from
</pre></div>
<p>Affine mappings of <span class="SimpleMath">n</span> dimensional space are often written as a pair <span class="SimpleMath">(A,v)</span> where <span class="SimpleMath">A</span> is a linear mapping and <span class="SimpleMath">v</span> is a vector. <strong class="pkg">GAP</strong> represents affine mappings by <span class="SimpleMath">n+1</span> times <span class="SimpleMath">n+1</span> matrices <span class="SimpleMath">M</span> which satisfy <span class="SimpleMath">M_{n+1,n+1}=1</span> and <span class="SimpleMath">M_{i,n+1}=0</span> for all <span class="SimpleMath">1≤ i ≤ n</span>.</p>
<p>An affine matrix acts on an <span class="SimpleMath">n</span> dimensional space which is written as a space of <span class="SimpleMath">n+1</span> tuples with <span class="SimpleMath">n+1</span>st entry <span class="SimpleMath">1</span>. Here we give two functions to handle these affine matrices.</p>
<p><a id="X86BD4FE4871379AD" name="X86BD4FE4871379AD"></a></p>
<h4>2.2 <span class="Heading">Affine Matrices OnRight</span></h4>
<p><a id="X838946957FC75C17" name="X838946957FC75C17"></a></p>
<h5>2.2-1 LinearPartOfAffineMatOnRight</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ LinearPartOfAffineMatOnRight</code>( <var class="Arg">mat</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: the linear part of the affine matrix <var class="Arg">mat</var>. That is, everything except for the last row and column.</p>
<p><a id="X80DD4F2286D49F8D" name="X80DD4F2286D49F8D"></a></p>
<h5>2.2-2 BasisChangeAffineMatOnRight</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ BasisChangeAffineMatOnRight</code>( <var class="Arg">transform</var>, <var class="Arg">mat</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: affine matrix with same dimensions as <var class="Arg">mat</var></p>
<p>A basis change <var class="Arg">transform</var> of an <span class="SimpleMath">n</span> dimensional space induces a transformation on affine mappings on this space. If <var class="Arg">mat</var> is a affine matrix (in particular, it is <span class="SimpleMath">(n+1)× (n+1)</span>), this method returns the image of <var class="Arg">mat</var> under the basis transformation induced by <var class="Arg">transform</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">c:=[[0,1],[1,0]];</span>
[ [ 0, 1 ], [ 1, 0 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">m:=[[1/2,0,0],[0,2/3,0],[1,0,1]];</span>
[ [ 1/2, 0, 0 ], [ 0, 2/3, 0 ], [ 1, 0, 1 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">BasisChangeAffineMatOnRight(c,m);</span>
[ [ 2/3, 0, 0 ], [ 0, 1/2, 0 ], [ 0, 1, 1 ] ]
</pre></div>
<p><a id="X81F3C49580958FB6" name="X81F3C49580958FB6"></a></p>
<h5>2.2-3 TranslationOnRightFromVector</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ TranslationOnRightFromVector</code>( <var class="Arg">v</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: Affine matrix</p>
<p>Given a vector <var class="Arg">v</var> with <span class="SimpleMath">n</span> entries, this method returns a <span class="SimpleMath">(n+1)× (n+1)</span> matrix which corresponds to the affine translation defined by <var class="Arg">v</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">m:=TranslationOnRightFromVector([1,2,3]);;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">Display(m);</span>
[ [ 1, 0, 0, 0 ],
[ 0, 1, 0, 0 ],
[ 0, 0, 1, 0 ],
[ 1, 2, 3, 1 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">LinearPartOfAffineMatOnRight(m);</span>
[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">BasisChangeAffineMatOnRight([[3,2,1],[0,1,0],[0,0,1]],m);</span>
[ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 3, 4, 4, 1 ] ]
</pre></div>
<p><a id="X84A0B0637F269E37" name="X84A0B0637F269E37"></a></p>
<h4>2.3 <span class="Heading">Geometry</span></h4>
<p><a id="X7A94DAE679AD73E3" name="X7A94DAE679AD73E3"></a></p>
<h5>2.3-1 GramianOfAverageScalarProductFromFiniteMatrixGroup</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ GramianOfAverageScalarProductFromFiniteMatrixGroup</code>( <var class="Arg">G</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: Symmetric positive definite matrix</p>
<p>For a finite matrix group <var class="Arg">G</var>, the gramian matrix of the average scalar product is returned. This is the sum over all <span class="SimpleMath">gg^t</span> with <span class="SimpleMath">g∈ G</span> (actually it is enough to take a generating set). The group <var class="Arg">G</var> is orthogonal with respect to the scalar product induced by the returned matrix.</p>
<p><a id="X866942167802E036" name="X866942167802E036"></a></p>
<h5>2.3-2 <span class="Heading">Inequalities</span></h5>
<p>Inequalities are represented in the same way they are represented in <strong class="pkg">polymaking</strong>. The vector <span class="SimpleMath">(v_0,...,v_n)</span> represents the inequality <span class="SimpleMath">0≤ v_0+v_1 x_1+... + v_n x_n</span>.</p>
<p><a id="X80C365AA87BDDAFA" name="X80C365AA87BDDAFA"></a></p>
<h5>2.3-3 BisectorInequalityFromPointPair</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ BisectorInequalityFromPointPair</code>( <var class="Arg">v1</var>, <var class="Arg">v2</var>[, <var class="Arg">gram</var>] )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: vector of length <code class="code">Length(v1)+1</code></p>
<p>Calculates the inequality defining the half-space containing <var class="Arg">v1</var> such that <code class="code"><var class="Arg">v1</var>-<var class="Arg">v2</var></code> is perpendicular on the bounding hyperplane. And <code class="code">(<var class="Arg">v1</var>-<var class="Arg">v2</var>)/2</code> is contained in the bounding hyperplane.<br /> If the matrix <var class="Arg">gram</var> is given, it is used as the gramian matrix. Otherwiese, the standard scalar product is used. It is not checked if <var class="Arg">gram</var> is positive definite or symmetric.</p>
<p><a id="X8790464D86D189F4" name="X8790464D86D189F4"></a></p>
<h5>2.3-4 WhichSideOfHyperplane</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ WhichSideOfHyperplane</code>( <var class="Arg">v</var>, <var class="Arg">ineq</var> )</td><td class="tdright">( method )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ WhichSideOfHyperplaneNC</code>( <var class="Arg">v</var>, <var class="Arg">ineq</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: -1 (below) 0 (in) or 1 (above).</p>
<p>Let <var class="Arg">v</var> be a vector of length <span class="SimpleMath">n</span> and <var class="Arg">ineq</var> an inequality represented by a vector of length <span class="SimpleMath">n+1</span>. Then <code class="code">WhichSideOfHyperplane(<var class="Arg">v, ineq</var>)</code> returns 1 if <var class="Arg">v</var> is a solution of the inequality but not the equation given by <var class="Arg">ineq</var>, it returns 0 if <var class="Arg">v</var> is a solution to the equation and -1 if it is not a solution of the inequality <var class="Arg">ineq</var>.</p>
<p>The NC version does not test the input for correctness.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">BisectorInequalityFromPointPair([0,0],[1,0]);</span>
[ 1, -2, 0 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">ineq:=BisectorInequalityFromPointPair([0,0],[1,0],[[5,4],[4,5]]);</span>
[ 5, -10, -8 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">ineq{[2,3]}*[1/2,0];</span>
-5
<span class="GAPprompt">gap></span> <span class="GAPinput">WhichSideOfHyperplane([0,0],ineq);</span>
1
<span class="GAPprompt">gap></span> <span class="GAPinput">WhichSideOfHyperplane([1/2,0],ineq);</span>
0
</pre></div>
<p><a id="X83392C417B311B6B" name="X83392C417B311B6B"></a></p>
<h5>2.3-5 RelativePositionPointAndPolygon</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RelativePositionPointAndPolygon</code>( <var class="Arg">point</var>, <var class="Arg">poly</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: one of <code class="code">"VERTEX", "FACET", "OUTSIDE", "INSIDE"</code></p>
<p>Let <var class="Arg">poly</var> be a <code class="keyw">PolymakeObject</code> and <var class="Arg">point</var> a vector. If <var class="Arg">point</var> is a vertex of <var class="Arg">poly</var>, the string <code class="code">"VERTEX"</code> is returned. If <var class="Arg">point</var> lies inside <var class="Arg">poly</var>, <code class="code">"INSIDE"</code> is returned and if it lies in a facet, <code class="code">"FACET"</code> is returned and if <var class="Arg">point</var> does not lie inside <var class="Arg">poly</var>, the function returns <code class="code">"OUTSIDE"</code>.</p>
<p><a id="X7B14774981F80108" name="X7B14774981F80108"></a></p>
<h4>2.4 <span class="Heading">Space Groups</span></h4>
<p><a id="X7E2F20607F278B70" name="X7E2F20607F278B70"></a></p>
<h5>2.4-1 PointGroupRepresentatives</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ PointGroupRepresentatives</code>( <var class="Arg">group</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ PointGroupRepresentatives</code>( <var class="Arg">group</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: list of matrices</p>
<p>Given an <code class="keyw">AffineCrystGroupOnLeftOrRight</code> <var class="Arg">group</var>, this returns a list of representatives of the point group of <var class="Arg">group</var>. That is, a system of representatives for the factor group modulo translations. This is an attribute of <code class="keyw">AffineCrystGroupOnLeftOrRight</code></p>
<div class="chlinkprevnextbot"> <a href="chap0.html">[Top of Book]</a> <a href="chap0.html#contents">[Contents]</a> <a href="chap1.html">[Previous Chapter]</a> <a href="chap3.html">[Next Chapter]</a> </div>
<div class="chlinkbot"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a> <a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
<hr />
<p class="foot">generated by <a href="http://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
</body>
</html>
|