Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  chap61.html   Sprache: HTML

 
 products/sources/formale Sprachen/GAP/doc/ref/chap61.html


<?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 (ref) - Chapter 61: Vector Spaces</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="chap61"  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="chap5.html">5</a>  <a href="chap6.html">6</a>  <a href="chap7.html">7</a>  <a href="chap8.html">8</a>  <a href="chap9.html">9</a>  <a href="chap10.html">10</a>  <a href="chap11.html">11</a>  <a href="chap12.html">12</a>  <a href="chap13.html">13</a>  <a href="chap14.html">14</a>  <a href="chap15.html">15</a>  <a href="chap16.html">16</a>  <a href="chap17.html">17</a>  <a href="chap18.html">18</a>  <a href="chap19.html">19</a>  <a href="chap20.html">20</a>  <a href="chap21.html">21</a>  <a href="chap22.html">22</a>  <a href="chap23.html">23</a>  <a href="chap24.html">24</a>  <a href="chap25.html">25</a>  <a href="chap26.html">26</a>  <a href="chap27.html">27</a>  <a href="chap28.html">28</a>  <a href="chap29.html">29</a>  <a href="chap30.html">30</a>  <a href="chap31.html">31</a>  <a href="chap32.html">32</a>  <a href="chap33.html">33</a>  <a href="chap34.html">34</a>  <a href="chap35.html">35</a>  <a href="chap36.html">36</a>  <a href="chap37.html">37</a>  <a href="chap38.html">38</a>  <a href="chap39.html">39</a>  <a href="chap40.html">40</a>  <a href="chap41.html">41</a>  <a href="chap42.html">42</a>  <a href="chap43.html">43</a>  <a href="chap44.html">44</a>  <a href="chap45.html">45</a>  <a href="chap46.html">46</a>  <a href="chap47.html">47</a>  <a href="chap48.html">48</a>  <a href="chap49.html">49</a>  <a href="chap50.html">50</a>  <a href="chap51.html">51</a>  <a href="chap52.html">52</a>  <a href="chap53.html">53</a>  <a href="chap54.html">54</a>  <a href="chap55.html">55</a>  <a href="chap56.html">56</a>  <a href="chap57.html">57</a>  <a href="chap58.html">58</a>  <a href="chap59.html">59</a>  <a href="chap60.html">60</a>  <a href="chap61.html">61</a>  <a href="chap62.html">62</a>  <a href="chap63.html">63</a>  <a href="chap64.html">64</a>  <a href="chap65.html">65</a>  <a href="chap66.html">66</a>  <a href="chap67.html">67</a>  <a href="chap68.html">68</a>  <a href="chap69.html">69</a>  <a href="chap70.html">70</a>  <a href="chap71.html">71</a>  <a href="chap72.html">72</a>  <a href="chap73.html">73</a>  <a href="chap74.html">74</a>  <a href="chap75.html">75</a>  <a href="chap76.html">76</a>  <a href="chap77.html">77</a>  <a href="chap78.html">78</a>  <a href="chap79.html">79</a>  <a href="chap80.html">80</a>  <a href="chap81.html">81</a>  <a href="chap82.html">82</a>  <a href="chap83.html">83</a>  <a href="chap84.html">84</a>  <a href="chap85.html">85</a>  <a href="chap86.html">86</a>  <a href="chap87.html">87</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="chap60.html">[Previous Chapter]</a>    <a href="chap62.html">[Next Chapter]</a>   </div>

<p id="mathjaxlink" class="pcenter"><a href="chap61_mj.html">[MathJax on]</a></p>
<p><a id="X7DAD6700787EC845" name="X7DAD6700787EC845"></a></p>
<div class="ChapSects"><a href="chap61.html#X7DAD6700787EC845">61 <span class="Heading">Vector Spaces</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap61.html#X8754F7207CFDA38B">61.1 <span class="Heading">IsLeftVectorSpace (Filter)</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X80290A908241706B">61.1-1 IsLeftVectorSpace</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap61.html#X87AD06FE873619EA">61.2 <span class="Heading">Constructing Vector Spaces</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X805413157CE9BECF">61.2-1 VectorSpace</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X78C9826780BC9AE6">61.2-2 Subspace</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7B001BAF7D5FD5D0">61.2-3 AsVectorSpace</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7D4F84C27EDAC89B">61.2-4 AsSubspace</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap61.html#X789FB2D883E53662">61.3 <span class="Heading">Operations and Attributes for Vector Spaces</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X849651C6830C94A1">61.3-1 GeneratorsOfLeftVectorSpace</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X86DC71A9835430FD">61.3-2 TrivialSubspace</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap61.html#X8125675583357131">61.4 <span class="Heading">Domains of Subspaces of Vector Spaces</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7975E41A7B29C3FD">61.4-1 Subspaces</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7A8F5C367FAE3D1B">61.4-2 IsSubspacesVectorSpace</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap61.html#X828AA09B87F14FAD">61.5 <span class="Heading">Bases of Vector Spaces</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X8739510881F5D862">61.5-1 IsBasis</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X837BE54C80DE368E">61.5-2 Basis</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7C8EBFF5805F8C51">61.5-3 CanonicalBasis</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X8786D40B84120F38">61.5-4 RelativeBasis</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap61.html#X839B9C4880EBFB5F">61.6 <span class="Heading">Operations for Vector Space Bases</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7B1F17AE8027A590">61.6-1 BasisVectors</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X81E8AE88843B70FF">61.6-2 UnderlyingLeftModule</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X80B32F667BF6AFD8">61.6-3 Coefficients</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7D305AB3834889BF">61.6-4 LinearCombination</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7EB0D16A7EC2DEE3">61.6-5 EnumeratorByBasis</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X855625D47979005D">61.6-6 IteratorByBasis</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap61.html#X82809D6C82DE4EC2">61.7 <span class="Heading">Operations for Special Kinds of Bases</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7CC2B3DD81628CE9">61.7-1 IsCanonicalBasis</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X86DE147F8606B739">61.7-2 IsIntegralBasis</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7FC051C579D61223">61.7-3 IsNormalBasis</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap61.html#X7C11B9C3819F3EA2">61.8 <span class="Heading">Mutable Bases</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7F466FB47F7E9F00">61.8-1 IsMutableBasis</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X8115C061819E5172">61.8-2 MutableBasis</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7EC90F4F7BCAF8D4">61.8-3 NrBasisVectors</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7BA87512823A8CFD">61.8-4 ImmutableBasis</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X85B50AC77A22108B">61.8-5 IsContainedInSpan</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7B52C99B84316F61">61.8-6 CloseMutableBasis</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap61.html#X7D937EBC7DE2819B">61.9 <span class="Heading">Row and Matrix Spaces</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X79B305CE87511C4B">61.9-1 IsRowSpace</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7A2BBBA07B2BE8F8">61.9-2 IsMatrixSpace</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X83724C157F4FDFB4">61.9-3 IsGaussianSpace</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X80209A8785126AAB">61.9-4 FullRowSpace</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X876B66C37A7B749F">61.9-5 FullMatrixSpace</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X8534A750878478D0">61.9-6 DimensionOfVectors</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X865A540F85FAE2DF">61.9-7 IsSemiEchelonized</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X87DCA09579589106">61.9-8 SemiEchelonBasis</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7C3CC5F97FA048A4">61.9-9 IsCanonicalBasisFullRowModule</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X83D282697C1A3148">61.9-10 IsCanonicalBasisFullMatrixModule</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7D6537F87E940344">61.9-11 NormedRowVectors</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X815C69A57C042C34">61.9-12 SiftedVector</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap61.html#X7F61CECA84CEF39D">61.10 <span class="Heading">Vector Space Homomorphisms</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X82013D328645E370">61.10-1 LeftModuleGeneralMappingByImages</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X85F5293983E47B5A">61.10-2 LeftModuleHomomorphismByImages</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X8477E6C3872A6DBB">61.10-3 LeftModuleHomomorphismByMatrix</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X8494AA5D7C3B88AD">61.10-4 NaturalHomomorphismBySubspace</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X80015C78876B4F1E">61.10-5 Hom</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X8680ADD381ECF879">61.10-6 End</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7A9A08EA79259659">61.10-7 IsFullHomModule</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7C4737687E76A24A">61.10-8 IsPseudoCanonicalBasisFullHomModule</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X84F87C327A1856F2">61.10-9 IsLinearMappingsModule</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap61.html#X81503EB77FCE648D">61.11 <span class="Heading">Vector Spaces Handled By Nice Bases</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X826FD4BC7BA0559D">61.11-1 NiceFreeLeftModule</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X807B8032780C59A4">61.11-2 NiceVector</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X79350786800C2DD8">61.11-3 NiceFreeLeftModuleInfo</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X8388E0248690C214">61.11-4 NiceBasis</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X82BC30A487967F5B">61.11-5 IsBasisByNiceBasis</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X79D1DEA679AEDA40">61.11-6 IsHandledByNiceBasis</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap61.html#X8238195B851D3C44">61.12 <span class="Heading">How to Implement New Kinds of Vector Spaces</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7DE34C3E837FCBC3">61.12-1 DeclareHandlingByNiceBasis</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7E6077F0830A28DA">61.12-2 NiceBasisFiltersInfo</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X7A374553786DF5E7">61.12-3 CheckForHandlingByNiceBasis</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap61.html#X78515F448644204E">61.13 <span class="Heading">Tensor Products and Exterior and Symmetric Powers</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X81B2276A7EBA8ED1">61.13-1 TensorProduct</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X787BB7FF85F0AD68">61.13-2 ExteriorPower</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap61.html#X79E2C2AF842E8419">61.13-3 SymmetricPower</a></span>
</div></div>
</div>

<h3>61 <span class="Heading">Vector Spaces</span></h3>

<p><a id="X8754F7207CFDA38B" name="X8754F7207CFDA38B"></a></p>

<h4>61.1 <span class="Heading">IsLeftVectorSpace (Filter)</span></h4>

<p><a id="X80290A908241706B" name="X80290A908241706B"></a></p>

<h5>61.1-1 IsLeftVectorSpace</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsLeftVectorSpace</code>( <var class="Arg">V</var> )</td><td class="tdright">( category )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsVectorSpace</code>( <var class="Arg">V</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>A <em>vector space</em> in <strong class="pkg">GAP</strong> is a free left module (see <code class="func">IsFreeLeftModule</code> (<a href="chap57.html#X7C4832187F3D9228"><span class="RefLink">57.3-1</span></a>)) over a division ring (see Chapter <a href="chap58.html#X80A8E676814A19FD"><span class="RefLink">58</span></a>).</p>

<p>Whenever we talk about an <span class="SimpleMath">F</span>-vector space <var class="Arg">V</var> then <var class="Arg">V</var> is an additive group (see <code class="func">IsAdditiveGroup</code(<a href="chap55.html#X7B8FBD9082CE271B"><span class="RefLink">55.1-6</span></a>)) on which the division ring <span class="SimpleMath">F</span> acts via multiplication from the left such that this action and the addition in <var class="Arg">V</var> are left and right distributive. The division ring <span class="SimpleMath">F</span> can be accessed as value of the attribute <code class="func">LeftActingDomain</code> (<a href="chap57.html#X86F070E0807DC34E"><span class="RefLink">57.1-11</span></a>).</p>

<p>Vector spaces in <strong class="pkg">GAP</strong> are always <em>left</em> vector spaces, <code class="func">IsLeftVectorSpace</code> and <code class="func">IsVectorSpace</code> are synonyms.</p>

<p><a id="X87AD06FE873619EA" name="X87AD06FE873619EA"></a></p>

<h4>61.2 <span class="Heading">Constructing Vector Spaces</span></h4>

<p><a id="X805413157CE9BECF" name="X805413157CE9BECF"></a></p>

<h5>61.2-1 VectorSpace</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ VectorSpace</code>( <var class="Arg">F</var>, <var class="Arg">gens</var>[, <var class="Arg">zero</var>][, <var class="Arg">"basis"</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>For a field <var class="Arg">F</var> and a collection <var class="Arg">gens</var> of vectors, <code class="func">VectorSpace</code> returns the <var class="Arg">F</var>-vector space spanned by the elements in <var class="Arg">gens</var>.</p>

<p>The optional argument <var class="Arg">zero</var> can be used to specify the zero element of the space; <var class="Arg">zero</var> <em>must</em> be given if <var class="Arg">gens</var> is empty. The optional string <code class="code">"basis"</code> indicates that <var class="Arg">gens</var> is known to be linearly independent over <var class="Arg">F</var>, in particular the dimension of the vector space is immediately set; note that <code class="func">Basis</code> (<a href="chap61.html#X837BE54C80DE368E"><span class="RefLink">61.5-2</span></a>) need <em>not</em> return the basis formed by <var class="Arg">gens</var> if the string <code class="code">"basis"</code> is given as an argument.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">V:= VectorSpace( Rationals, [ [ 1, 2, 3 ], [ 1, 1, 1 ] ] );</span>
<vector space over Rationals, with 2 generators>
</pre></div>

<p><a id="X78C9826780BC9AE6" name="X78C9826780BC9AE6"></a></p>

<h5>61.2-2 Subspace</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Subspace</code>( <var class="Arg">V</var>, <var class="Arg">gens</var>[, <var class="Arg">"basis"</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SubspaceNC</code>( <var class="Arg">V</var>, <var class="Arg">gens</var>[, <var class="Arg">"basis"</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>For an <span class="SimpleMath">F</span>-vector space <var class="Arg">V</var> and a list or collection <var class="Arg">gens</var> that is a subset of <var class="Arg">V</var>, <code class="func">Subspace</code> returns the <span class="SimpleMath">F</span>-vector space spanned by <var class="Arg">gens</var>; if <var class="Arg">gens</var> is empty then the trivial subspace (see <code class="func">TrivialSubspace</code> (<a href="chap61.html#X86DC71A9835430FD"><span class="RefLink">61.3-2</span></a>)) of <var class="Arg">V</var> is returned. The parent (see <a href="chap31.html#X7CBDD36E7B7BE286"><span class="RefLink">31.7</span></a>) of the returned vector space is set to <var class="Arg">V</var>.</p>

<p><code class="func">SubspaceNC</code> does the same as <code class="func">Subspace</code>, except that it omits the check whether <var class="Arg">gens</var> is a subset of <var class="Arg">V</var>.</p>

<p>The optional string <var class="Arg">"basis"</var> indicates that <var class="Arg">gens</var> is known to be linearly independent over <span class="SimpleMath">F</span>. In this case the dimension of the subspace is immediately set, and both <code class="func">Subspace</code> and <code class="func">SubspaceNC</code> do <em>not</em> check whether <var class="Arg">gens</var> really is linearly independent and whether <var class="Arg">gens</var> is a subset of <var class="Arg">V</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">V:= VectorSpace( Rationals, [ [ 1, 2, 3 ], [ 1, 1, 1 ] ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">W:= Subspace( V, [ [ 0, 1, 2 ] ] );</span>
<vector space over Rationals, with 1 generator>
</pre></div>

<p><a id="X7B001BAF7D5FD5D0" name="X7B001BAF7D5FD5D0"></a></p>

<h5>61.2-3 AsVectorSpace</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ AsVectorSpace</code>( <var class="Arg">F</var>, <var class="Arg">D</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Let <var class="Arg">F</var> be a division ring and <var class="Arg">D</var> a domain. If the elements in <var class="Arg">D</varform an <var class="Arg">F</var>-vector space then <code class="func">AsVectorSpace</code> returns this <var class="Arg">F</var>-vector space, otherwise <code class="keyw">fail</code> is returned.</p>

<p><code class="func">AsVectorSpace</code> can be used for example to view a given vector space as a vector space over a smaller or larger division ring.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">V:= FullRowSpace( GF( 27 ), 3 );</span>
( GF(3^3)^3 )
<span class="GAPprompt">gap></span> <span class="GAPinput">Dimension( V );  LeftActingDomain( V );</span>
3
GF(3^3)
<span class="GAPprompt">gap></span> <span class="GAPinput">W:= AsVectorSpace( GF( 3 ), V );</span>
<vector space over GF(3), with 9 generators>
<span class="GAPprompt">gap></span> <span class="GAPinput">Dimension( W );  LeftActingDomain( W );</span>
9
GF(3)
<span class="GAPprompt">gap></span> <span class="GAPinput">AsVectorSpace( GF( 9 ), V );</span>
fail
</pre></div>

<p><a id="X7D4F84C27EDAC89B" name="X7D4F84C27EDAC89B"></a></p>

<h5>61.2-4 AsSubspace</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ AsSubspace</code>( <var class="Arg">V</var>, <var class="Arg">U</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Let <var class="Arg">V</var> be an <span class="SimpleMath">F</span>-vector space, and <var class="Arg">U</var> a collection. If <var class="Arg">U</var> is a subset of <var class="Arg">V</var> such that the elements of <var class="Arg">U</varform an <span class="SimpleMath">F</span>-vector space then <code class="func">AsSubspace</code> returns this vector space, with parent set to <var class="Arg">V</var> (see <code class="func">AsVectorSpace</code> (<a href="chap61.html#X7B001BAF7D5FD5D0"><span class="RefLink">61.2-3</span></a>)). Otherwise <code class="keyw">fail</code> is returned.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">V:= VectorSpace( Rationals, [ [ 1, 2, 3 ], [ 1, 1, 1 ] ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">W:= VectorSpace( Rationals, [ [ 1/2, 1/2, 1/2 ] ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">U:= AsSubspace( V, W );</span>
<vector space over Rationals, with 1 generator>
<span class="GAPprompt">gap></span> <span class="GAPinput">Parent( U ) = V;</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">AsSubspace( V, [ [ 1, 1, 1 ] ] );</span>
fail
</pre></div>

<p><a id="X789FB2D883E53662" name="X789FB2D883E53662"></a></p>

<h4>61.3 <span class="Heading">Operations and Attributes for Vector Spaces</span></h4>

<p><a id="X849651C6830C94A1" name="X849651C6830C94A1"></a></p>

<h5>61.3-1 GeneratorsOfLeftVectorSpace</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ GeneratorsOfLeftVectorSpace</code>( <var class="Arg">V</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">‣ GeneratorsOfVectorSpace</code>( <var class="Arg">V</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>For an <span class="SimpleMath">F</span>-vector space <var class="Arg">V</var>, <code class="func">GeneratorsOfLeftVectorSpace</code> returns a list of vectors in <var class="Arg">V</var> that generate <var class="Arg">V</var> as an <span class="SimpleMath">F</span>-vector space.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">GeneratorsOfVectorSpace( FullRowSpace( Rationals, 3 ) );</span>
[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ]
</pre></div>

<p><a id="X86DC71A9835430FD" name="X86DC71A9835430FD"></a></p>

<h5>61.3-2 TrivialSubspace</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ TrivialSubspace</code>( <var class="Arg">V</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>For a vector space <var class="Arg">V</var>, <code class="func">TrivialSubspace</code> returns the subspace of <var class="Arg">V</var> that consists of the zero vector in <var class="Arg">V</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">V:= GF(3)^3;;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">triv:= TrivialSubspace( V );</span>
<vector space of dimension 0 over GF(3)>
<span class="GAPprompt">gap></span> <span class="GAPinput">AsSet( triv );</span>
[ [ 0*Z(3), 0*Z(3), 0*Z(3) ] ]
</pre></div>

<p><a id="X8125675583357131" name="X8125675583357131"></a></p>

<h4>61.4 <span class="Heading">Domains of Subspaces of Vector Spaces</span></h4>

<p><a id="X7975E41A7B29C3FD" name="X7975E41A7B29C3FD"></a></p>

<h5>61.4-1 Subspaces</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Subspaces</code>( <var class="Arg">V</var>[, <var class="Arg">k</var>] )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>Called with a finite vector space <var class="Arg">V</var>, <code class="func">Subspaces</code> returns the domain of all subspaces of <var class="Arg">V</var>.</p>

<p>Called with <var class="Arg">V</var> and a nonnegative integer <var class="Arg">k</var>, <code class="func">Subspaces</code> returns the domain of all <var class="Arg">k</var>-dimensional subspaces of <var class="Arg">V</var>.</p>

<p>Special <code class="func">Size</code> (<a href="chap30.html#X858ADA3B7A684421"><span class="RefLink">30.4-6</span></a>) and <code class="func">Iterator</code> (<a href="chap30.html#X83ADF8287ED0668E"><span class="RefLink">30.8-1</span></a>) methods are provided for these domains.</p>

<p><a id="X7A8F5C367FAE3D1B" name="X7A8F5C367FAE3D1B"></a></p>

<h5>61.4-2 IsSubspacesVectorSpace</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsSubspacesVectorSpace</code>( <var class="Arg">D</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>The domain of all subspaces of a (finite) vector space or of all subspaces of fixed dimension, as returned by <code class="func">Subspaces</code> (<a href="chap61.html#X7975E41A7B29C3FD"><span class="RefLink">61.4-1</span></a>) (see <code class="func">Subspaces</code> (<a href="chap61.html#X7975E41A7B29C3FD"><span class="RefLink">61.4-1</span></a>)) lies in the category <code class="func">IsSubspacesVectorSpace</code>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">D:= Subspaces( GF(3)^3 );</span>
Subspaces( ( GF(3)^3 ) )
<span class="GAPprompt">gap></span> <span class="GAPinput">Size( D );</span>
28
<span class="GAPprompt">gap></span> <span class="GAPinput">iter:= Iterator( D );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">NextIterator( iter );</span>
<vector space of dimension 0 over GF(3)>
<span class="GAPprompt">gap></span> <span class="GAPinput">NextIterator( iter );</span>
<vector space of dimension 1 over GF(3)>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsSubspacesVectorSpace( D );</span>
true
</pre></div>

<p><a id="X828AA09B87F14FAD" name="X828AA09B87F14FAD"></a></p>

<h4>61.5 <span class="Heading">Bases of Vector Spaces</span></h4>

<p>In <strong class="pkg">GAP</strong>, a <em>basis</em> of a free left <span class="SimpleMath">F</span>-module <span class="SimpleMath">V</span> is a list of vectors <span class="SimpleMath">B = [ v_1, v_2, ..., v_n ]</span> in <span class="SimpleMath">V</span> such that <span class="SimpleMath">V</span> is generated as a left <span class="SimpleMath">F</span>-module by these vectors and such that <span class="SimpleMath">B</span> is linearly independent over <span class="SimpleMath">F</span>. The integer <span class="SimpleMath">n</span> is the dimension of <span class="SimpleMath">V</span> (see <code class="func">Dimension</code> (<a href="chap57.html#X7E6926C6850E7C4E"><span class="RefLink">57.3-3</span></a>)). In particular, as each basis is a list (see Chapter <a href="chap21.html#X7B256AE5780F140A"><span class="RefLink">21</span></a>), it has a length (see <code class="func">Length</code> (<a href="chap21.html#X780769238600AFD1"><span class="RefLink">21.17-5</span></a>)), and the <span class="SimpleMath">i</span>-th vector of <span class="SimpleMath">B</span> can be accessed as <span class="SimpleMath">B[i]</span>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">V:= Rationals^3;</span>
( Rationals^3 )
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= Basis( V );</span>
CanonicalBasis( ( Rationals^3 ) )
<span class="GAPprompt">gap></span> <span class="GAPinput">Length( B );</span>
3
<span class="GAPprompt">gap></span> <span class="GAPinput">B[1];</span>
[ 1, 0, 0 ]
</pre></div>

<p>The operations described below make sense only for bases of <em>finite</em> dimensional vector spaces. (In practice this means that the vector spaces must be <em>low</em> dimensional, that is, the dimension should not exceed a few hundred.)</p>

<p>Besides the basic operations for lists (see <a href="chap21.html#X7B202D147A5C2884"><span class="RefLink">21.2</span></a>), the <em>basic operations for bases</em> are <code class="func">BasisVectors</code> (<a href="chap61.html#X7B1F17AE8027A590"><span class="RefLink">61.6-1</span></a>), <code class="func">Coefficients</code> (<a href="chap61.html#X80B32F667BF6AFD8"><span class="RefLink">61.6-3</span></a>), <code class="func">LinearCombination</code> (<a href="chap61.html#X7D305AB3834889BF"><span class="RefLink">61.6-4</span></a>), and <code class="func">UnderlyingLeftModule</code> (<a href="chap61.html#X81E8AE88843B70FF"><span class="RefLink">61.6-2</span></a>). These and other operations for arbitrary bases are described in <a href="chap61.html#X839B9C4880EBFB5F"><span class="RefLink">61.6</span></a>.</p>

<p>For special kinds of bases, further operations are defined (see <a href="chap61.html#X82809D6C82DE4EC2"><span class="RefLink">61.7</span></a>).</p>

<p><strong class="pkg">GAP</strong> supports the following three kinds of bases.</p>

<p><em>Relative bases</em> delegate the work to other bases of the same free left module, via basechange matrices (see <code class="func">RelativeBasis</code> (<a href="chap61.html#X8786D40B84120F38"><span class="RefLink">61.5-4</span></a>)).</p>

<p><em>Bases handled by nice bases</em> delegate the work to bases of isomorphic left modules over the same left acting domain (see <a href="chap61.html#X81503EB77FCE648D"><span class="RefLink">61.11</span></a>).</p>

<p>Finally, of course there must be bases in <strong class="pkg">GAP</strong> that really do the work.</p>

<p>For example, in the case of a Gaussian row or matrix space <var class="Arg">V</var> (see <a href="chap61.html#X7D937EBC7DE2819B"><span class="RefLink">61.9</span></a>), <code class="code">Basis( <var class="Arg">V</var> )</code> is a semi-echelonized basis (see <code class="func">IsSemiEchelonized</code> (<a href="chap61.html#X865A540F85FAE2DF"><span class="RefLink">61.9-7</span></a>)) that uses Gaussian elimination; such a basis is of the third kind. <code class="code">Basis( <var class="Arg">V</var>, <var class="Arg">vectors</var> )</code> is either semi-echelonized or a relative basis. Other examples of bases of the third kind are canonical bases of finite fields and of abelian number fields.</p>

<p>Bases handled by nice bases are described in <a href="chap61.html#X81503EB77FCE648D"><span class="RefLink">61.11</span></a>. Examples are non-Gaussian row and matrix spaces, and subspaces of finite fields and abelian number fields that are themselves not fields.</p>

<p><a id="X8739510881F5D862" name="X8739510881F5D862"></a></p>

<h5>61.5-1 IsBasis</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsBasis</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>In <strong class="pkg">GAP</strong>, a <em>basis</em> of a free left module is an object that knows how to compute coefficients w.r.t. its basis vectors (see <code class="func">Coefficients</code> (<a href="chap61.html#X80B32F667BF6AFD8"><span class="RefLink">61.6-3</span></a>)). Bases are constructed by <code class="func">Basis</code> (<a href="chap61.html#X837BE54C80DE368E"><span class="RefLink">61.5-2</span></a>). Each basis is an immutable list, the <span class="SimpleMath">i</span>-th entry being the <span class="SimpleMath">i</span>-th basis vector.</p>

<p>(See <a href="chap61.html#X7C11B9C3819F3EA2"><span class="RefLink">61.8</span></a> for mutable bases.)</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">V:= GF(2)^2;;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= Basis( V );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsBasis( B );</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">IsBasis( [ [ 1, 0 ], [ 0, 1 ] ] );</span>
false
<span class="GAPprompt">gap></span> <span class="GAPinput">IsBasis( Basis( Rationals^2, [ [ 1, 0 ], [ 0, 1 ] ] ) );</span>
true
</pre></div>

<p><a id="X837BE54C80DE368E" name="X837BE54C80DE368E"></a></p>

<h5>61.5-2 Basis</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Basis</code>( <var class="Arg">V</var>[, <var class="Arg">vectors</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">‣ BasisNC</code>( <var class="Arg">V</var>, <var class="Arg">vectors</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Called with a free left <span class="SimpleMath">F</span>-module <var class="Arg">V</var> as the only argument, <code class="func">Basis</code> returns an <span class="SimpleMath">F</span>-basis of <var class="Arg">V</var> whose vectors are not further specified.</p>

<p>If additionally a list <var class="Arg">vectors</var> of vectors in <var class="Arg">V</var> is given that forms an <span class="SimpleMath">F</span>-basis of <var class="Arg">V</var> then <code class="func">Basis</code> returns this basis; if <var class="Arg">vectors</var> is not linearly independent over <span class="SimpleMath">F</span> or does not generate <var class="Arg">V</var> as a free left <span class="SimpleMath">F</span>-module then <code class="keyw">fail</code> is returned.</p>

<p><code class="func">BasisNC</code> does the same as the two argument version of <code class="func">Basis</code>, except that it does not check whether <var class="Arg">vectors</varform a basis.</p>

<p>If no basis vectors are prescribed then <code class="func">Basis</code> need not compute basis vectors; in this case, the vectors are computed in the first call to <code class="func">BasisVectors</code> (<a href="chap61.html#X7B1F17AE8027A590"><span class="RefLink">61.6-1</span></a>).</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">V:= VectorSpace( Rationals, [ [ 1, 2, 7 ], [ 1/2, 1/3, 5 ] ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= Basis( V );</span>
SemiEchelonBasis( <vector space over Rationals, with
2 generators>, ... )
<span class="GAPprompt">gap></span> <span class="GAPinput">BasisVectors( B );</span>
[ [ 1, 2, 7 ], [ 0, 1, -9/4 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= Basis( V, [ [ 1, 2, 7 ], [ 3, 2, 30 ] ] );</span>
Basis( <vector space over Rationals, with 2 generators>,
[ [ 1, 2, 7 ], [ 3, 2, 30 ] ] )
<span class="GAPprompt">gap></span> <span class="GAPinput">Basis( V, [ [ 1, 2, 3 ] ] );</span>
fail
</pre></div>

<p><a id="X7C8EBFF5805F8C51" name="X7C8EBFF5805F8C51"></a></p>

<h5>61.5-3 CanonicalBasis</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ CanonicalBasis</code>( <var class="Arg">V</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>If the vector space <var class="Arg">V</var> supports a <em>canonical basis</em> then <code class="func">CanonicalBasis</code> returns this basis, otherwise <code class="keyw">fail</code> is returned.</p>

<p>The defining property of a canonical basis is that its vectors are uniquely determined by the vector space. If canonical bases exist for two vector spaces over the same left acting domain (see <code class="func">LeftActingDomain</code> (<a href="chap57.html#X86F070E0807DC34E"><span class="RefLink">57.1-11</span></a>)) then the equality of these vector spaces can be decided by comparing the canonical bases.</p>

<p>The exact meaning of a canonical basis depends on the type of <var class="Arg">V</var>. Canonical bases are defined for example for Gaussian row and matrix spaces (see <a href="chap61.html#X7D937EBC7DE2819B"><span class="RefLink">61.9</span></a>).</p>

<p>If one designs a new kind of vector spaces (see <a href="chap61.html#X8238195B851D3C44"><span class="RefLink">61.12</span></a>) and defines a canonical basis for these spaces then the <code class="func">CanonicalBasis</code> method one installs (see <code class="func">InstallMethod</code> (<a href="chap78.html#X837EFDAB7BEF290B"><span class="RefLink">78.3-1</span></a>)) must <em>not</em> call <code class="func">Basis</code> (<a href="chap61.html#X837BE54C80DE368E"><span class="RefLink">61.5-2</span></a>). On the other hand, one probably should install a <code class="func">Basis</code> (<a href="chap61.html#X837BE54C80DE368E"><span class="RefLink">61.5-2</span></a>) method that simply calls <code class="func">CanonicalBasis</code>, the value of the method (see <a href="chap78.html#X795EE8257848B438"><span class="RefLink">78.3</span></a> and <a href="chap78.html#X851FC6387CA2B241"><span class="RefLink">78.4</span></a>) being <code class="code">CANONICAL_BASIS_FLAGS</code>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">vecs:= [ [ 1, 2, 3 ], [ 1, 1, 1 ], [ 1, 1, 1 ] ];;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">V:= VectorSpace( Rationals, vecs );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= CanonicalBasis( V );</span>
CanonicalBasis( <vector space over Rationals, with 3 generators> )
<span class="GAPprompt">gap></span> <span class="GAPinput">BasisVectors( B );</span>
[ [ 1, 0, -1 ], [ 0, 1, 2 ] ]
</pre></div>

<p><a id="X8786D40B84120F38" name="X8786D40B84120F38"></a></p>

<h5>61.5-4 RelativeBasis</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RelativeBasis</code>( <var class="Arg">B</var>, <var class="Arg">vectors</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RelativeBasisNC</code>( <var class="Arg">B</var>, <var class="Arg">vectors</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>A relative basis is a basis of the free left module <var class="Arg">V</var> that delegates the computation of coefficients etc. to another basis of <var class="Arg">V</var> via a basechange matrix.</p>

<p>Let <var class="Arg">B</var> be a basis of the free left module <var class="Arg">V</var>, and <var class="Arg">vectors</var> a list of vectors in <var class="Arg">V</var>.</p>

<p><code class="func">RelativeBasis</code> checks whether <var class="Arg">vectors</varform a basis of <var class="Arg">V</var>, and in this case a basis is returned in which <var class="Arg">vectors</var> are the basis vectors; otherwise <code class="keyw">fail</code> is returned.</p>

<p><code class="func">RelativeBasisNC</code> does the same, except that it omits the check.</p>

<p><a id="X839B9C4880EBFB5F" name="X839B9C4880EBFB5F"></a></p>

<h4>61.6 <span class="Heading">Operations for Vector Space Bases</span></h4>

<p><a id="X7B1F17AE8027A590" name="X7B1F17AE8027A590"></a></p>

<h5>61.6-1 BasisVectors</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ BasisVectors</code>( <var class="Arg">B</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>For a vector space basis <var class="Arg">B</var>, <code class="code">BasisVectors</code> returns the list of basis vectors of <var class="Arg">B</var>. The lists <var class="Arg">B</var> and <code class="code">BasisVectors( <var class="Arg">B</var> )</code> are equal; the main purpose of <code class="code">BasisVectors</code> is to provide access to a list of vectors that does <em>not</em> know about an underlying vector space.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">V:= VectorSpace( Rationals, [ [ 1, 2, 7 ], [ 1/2, 1/3, 5 ] ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= Basis( V, [ [ 1, 2, 7 ], [ 0, 1, -9/4 ] ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">BasisVectors( B );</span>
[ [ 1, 2, 7 ], [ 0, 1, -9/4 ] ]
</pre></div>

<p><a id="X81E8AE88843B70FF" name="X81E8AE88843B70FF"></a></p>

<h5>61.6-2 UnderlyingLeftModule</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ UnderlyingLeftModule</code>( <var class="Arg">B</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>For a basis <var class="Arg">B</var> of a free left module <span class="SimpleMath">V</span>, <code class="func">UnderlyingLeftModule</code> returns <span class="SimpleMath">V</span>.</p>

<p>The reason why a basis stores a free left module is that otherwise one would have to store the basis vectors and the coefficient domain separately. Storing the module allows one for example to deal with bases whose basis vectors have not yet been computed yet (see <code class="func">Basis</code> (<a href="chap61.html#X837BE54C80DE368E"><span class="RefLink">61.5-2</span></a>)); furthermore, in some cases it is convenient to test membership of a vector in the module before computing coefficients w.r.t. a basis.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= Basis( GF(2)^6 );;  UnderlyingLeftModule( B );</span>
( GF(2)^6 )
</pre></div>

<p><a id="X80B32F667BF6AFD8" name="X80B32F667BF6AFD8"></a></p>

<h5>61.6-3 Coefficients</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Coefficients</code>( <var class="Arg">B</var>, <var class="Arg">v</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Let <span class="SimpleMath">V</span> be the underlying left module of the basis <var class="Arg">B</var>, and <var class="Arg">v</var> a vector such that the family of <var class="Arg">v</var> is the elements family of the family of <span class="SimpleMath">V</span>. Then <code class="code">Coefficients( <var class="Arg">B</var>, <var class="Arg">v</var> )</code> is the list of coefficients of <var class="Arg">v</var> w.r.t. <var class="Arg">B</var> if <var class="Arg">v</var> lies in <span class="SimpleMath">V</span>, and <code class="keyw">fail</code> otherwise.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">V:= VectorSpace( Rationals, [ [ 1, 2, 7 ], [ 1/2, 1/3, 5 ] ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= Basis( V, [ [ 1, 2, 7 ], [ 0, 1, -9/4 ] ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">Coefficients( B, [ 1/2, 1/3, 5 ] );</span>
[ 1/2, -2/3 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">Coefficients( B, [ 1, 0, 0 ] );</span>
fail
</pre></div>

<p><a id="X7D305AB3834889BF" name="X7D305AB3834889BF"></a></p>

<h5>61.6-4 LinearCombination</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ LinearCombination</code>( <var class="Arg">B</var>, <var class="Arg">coeff</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>If <var class="Arg">B</var> is a basis object (see <code class="func">IsBasis</code> (<a href="chap61.html#X8739510881F5D862"><span class="RefLink">61.5-1</span></a>)) or a homogeneous list of length <span class="SimpleMath">n</span>, and <var class="Arg">coeff</var> is a row vector of the same length, <code class="func">LinearCombination</code> returns the vector <span class="SimpleMath">∑_{i = 1}^n <var class="Arg">coeff</var>[i] * <var class="Arg">B</var>[i]</span>.</p>

<p>Perhaps the most important usage is the case where <var class="Arg">B</var> forms a basis.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">V:= VectorSpace( Rationals, [ [ 1, 2, 7 ], [ 1/2, 1/3, 5 ] ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= Basis( V, [ [ 1, 2, 7 ], [ 0, 1, -9/4 ] ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">LinearCombination( B, [ 1/2, -2/3 ] );</span>
[ 1/2, 1/3, 5 ]
</pre></div>

<p><a id="X7EB0D16A7EC2DEE3" name="X7EB0D16A7EC2DEE3"></a></p>

<h5>61.6-5 EnumeratorByBasis</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ EnumeratorByBasis</code>( <var class="Arg">B</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>For a basis <var class="Arg">B</var> of the free left <span class="SimpleMath">F</span>-module <span class="SimpleMath">V</span> of dimension <span class="SimpleMath">n</span>, <code class="code">EnumeratorByBasis</code> returns an enumerator that loops over the elements of <span class="SimpleMath">V</span> as linear combinations of the vectors of <var class="Arg">B</var> with coefficients the row vectors in the full row space (see <code class="func">FullRowSpace</code> (<a href="chap61.html#X80209A8785126AAB"><span class="RefLink">61.9-4</span></a>)) of dimension <span class="SimpleMath">n</span> over <span class="SimpleMath">F</span>, in the succession given by the default enumerator of this row space.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">V:= GF(2)^3;;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">enum:= EnumeratorByBasis( CanonicalBasis( V ) );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">Print( enum{ [ 1 .. 4 ] }, "\n" );</span>
[ [ 0*Z(2), 0*Z(2), 0*Z(2) ], [ 0*Z(2), 0*Z(2), Z(2)^0 ],
  [ 0*Z(2), Z(2)^0, 0*Z(2) ], [ 0*Z(2), Z(2)^0, Z(2)^0 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= Basis( V, [ [ 1, 1, 1 ], [ 1, 1, 0 ], [ 1, 0, 0 ] ] * Z(2) );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">enum:= EnumeratorByBasis( B );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">Print( enum{ [ 1 .. 4 ] }, "\n" );</span>
[ [ 0*Z(2), 0*Z(2), 0*Z(2) ], [ Z(2)^0, 0*Z(2), 0*Z(2) ],
  [ Z(2)^0, Z(2)^0, 0*Z(2) ], [ 0*Z(2), Z(2)^0, 0*Z(2) ] ]
</pre></div>

<p><a id="X855625D47979005D" name="X855625D47979005D"></a></p>

<h5>61.6-6 IteratorByBasis</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IteratorByBasis</code>( <var class="Arg">B</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>For a basis <var class="Arg">B</var> of the free left <span class="SimpleMath">F</span>-module <span class="SimpleMath">V</span> of dimension <span class="SimpleMath">n</span>, <code class="code">IteratorByBasis</code> returns an iterator that loops over the elements of <span class="SimpleMath">V</span> as linear combinations of the vectors of <var class="Arg">B</var> with coefficients the row vectors in the full row space (see <code class="func">FullRowSpace</code> (<a href="chap61.html#X80209A8785126AAB"><span class="RefLink">61.9-4</span></a>)) of dimension <span class="SimpleMath">n</span> over <span class="SimpleMath">F</span>, in the succession given by the default enumerator of this row space.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">V:= GF(2)^3;;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">iter:= IteratorByBasis( CanonicalBasis( V ) );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">for i in [ 1 .. 4 ] do Print( NextIterator( iter ), "\n" ); od;</span>
[ 0*Z(2), 0*Z(2), 0*Z(2) ]
[ 0*Z(2), 0*Z(2), Z(2)^0 ]
[ 0*Z(2), Z(2)^0, 0*Z(2) ]
[ 0*Z(2), Z(2)^0, Z(2)^0 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= Basis( V, [ [ 1, 1, 1 ], [ 1, 1, 0 ], [ 1, 0, 0 ] ] * Z(2) );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">iter:= IteratorByBasis( B );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">for i in [ 1 .. 4 ] do Print( NextIterator( iter ), "\n" ); od;</span>
[ 0*Z(2), 0*Z(2), 0*Z(2) ]
[ Z(2)^0, 0*Z(2), 0*Z(2) ]
[ Z(2)^0, Z(2)^0, 0*Z(2) ]
[ 0*Z(2), Z(2)^0, 0*Z(2) ]
</pre></div>

<p><a id="X82809D6C82DE4EC2" name="X82809D6C82DE4EC2"></a></p>

<h4>61.7 <span class="Heading">Operations for Special Kinds of Bases</span></h4>

<p><a id="X7CC2B3DD81628CE9" name="X7CC2B3DD81628CE9"></a></p>

<h5>61.7-1 IsCanonicalBasis</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsCanonicalBasis</code>( <var class="Arg">B</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>If the underlying free left module <span class="SimpleMath">V</span> of the basis <var class="Arg">B</var> supports a canonical basis (see <code class="func">CanonicalBasis</code> (<a href="chap61.html#X7C8EBFF5805F8C51"><span class="RefLink">61.5-3</span></a>)) then <code class="func">IsCanonicalBasis</code> returns <code class="keyw">true</code> if <var class="Arg">B</var> is equal to the canonical basis of <span class="SimpleMath">V</span>, and <code class="keyw">false</code> otherwise.</p>

<p><a id="X86DE147F8606B739" name="X86DE147F8606B739"></a></p>

<h5>61.7-2 IsIntegralBasis</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsIntegralBasis</code>( <var class="Arg">B</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>Let <var class="Arg">B</var> be an <span class="SimpleMath">S</span>-basis of a <em>field</em> <span class="SimpleMath">F</span> for a subfield <span class="SimpleMath">S</span> of <span class="SimpleMath">F</span>, and let <span class="SimpleMath">R</span> and <span class="SimpleMath">M</span> be the rings of algebraic integers in <span class="SimpleMath">S</span> and <span class="SimpleMath">F</span>, respectively. <code class="code">IsIntegralBasis</code> returns <code class="keyw">true</code> if <var class="Arg">B</var> is also an <span class="SimpleMath">R</span>-basis of <span class="SimpleMath">M</span>, and <code class="keyw">false</code> otherwise.</p>

<p><a id="X7FC051C579D61223" name="X7FC051C579D61223"></a></p>

<h5>61.7-3 IsNormalBasis</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsNormalBasis</code>( <var class="Arg">B</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>Let <var class="Arg">B</var> be an <span class="SimpleMath">S</span>-basis of a <em>field</em> <span class="SimpleMath">F</span> for a subfield <span class="SimpleMath">S</span> of <span class="SimpleMath">F</span>. <code class="code">IsNormalBasis</code> returns <code class="keyw">true</code> if <var class="Arg">B</var> is invariant under the Galois group (see <code class="func">GaloisGroup</code> (<a href="chap58.html#X80CAA5BA82F09ED2"><span class="RefLink">58.3-1</span></a>)) of the field extension <span class="SimpleMath">F / S</span>, and <code class="keyw">false</code> otherwise.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= CanonicalBasis( GaussianRationals );</span>
CanonicalBasis( GaussianRationals )
<span class="GAPprompt">gap></span> <span class="GAPinput">IsIntegralBasis( B );  IsNormalBasis( B );</span>
true
false
</pre></div>

<p><a id="X7C11B9C3819F3EA2" name="X7C11B9C3819F3EA2"></a></p>

<h4>61.8 <span class="Heading">Mutable Bases</span></h4>

<p>It is useful to have a <em>mutable basis</em> of a free module when successively closures with new vectors are formed, since one does not want to create a new module and a corresponding basis for each step.</p>

<p>Note that the situation here is different from the situation with stabilizer chains, which are (mutable or immutable) records that do not need to know about the groups they describe, whereas each (immutable) basis stores the underlying left module (see <code class="func">UnderlyingLeftModule</code> (<a href="chap61.html#X81E8AE88843B70FF"><span class="RefLink">61.6-2</span></a>)).</p>

<p>So immutable bases and mutable bases are different categories of objects. The only thing they have in common is that one can ask both for their basis vectors and for the coefficients of a given vector.</p>

<p>Since <code class="code">Immutable</code> produces an immutable copy of any <strong class="pkg">GAP</strongobject, it would in principle be possible to construct a mutable basis that is in fact immutable. In the sequel, we will deal only with mutable bases that are in fact <em>mutable</em> <strong class="pkg">GAP</strong> objects, hence these objects are unable to store attribute values.</p>

<p>Basic operations for immutable bases are <code class="func">NrBasisVectors</code> (<a href="chap61.html#X7EC90F4F7BCAF8D4"><span class="RefLink">61.8-3</span></a>), <code class="func">IsContainedInSpan</code> (<a href="chap61.html#X85B50AC77A22108B"><span class="RefLink">61.8-5</span></a>), <code class="func">CloseMutableBasis</code> (<a href="chap61.html#X7B52C99B84316F61"><span class="RefLink">61.8-6</span></a>), <code class="func">ImmutableBasis</code> (<a href="chap61.html#X7BA87512823A8CFD"><span class="RefLink">61.8-4</span></a>), <code class="func">Coefficients</code> (<a href="chap61.html#X80B32F667BF6AFD8"><span class="RefLink">61.6-3</span></a>), and <code class="func">BasisVectors</code> (<a href="chap61.html#X7B1F17AE8027A590"><span class="RefLink">61.6-1</span></a>). <code class="func">ShallowCopy</code> (<a href="chap12.html#X846BC7107C352031"><span class="RefLink">12.7-1</span></a>) for a mutable basis returns a mutable plain list containing the current basis vectors.</p>

<p>Since mutable bases do not admit arbitrary changes of their lists of basis vectors, a mutable basis is <em>not</em> a list. It is, however, a collection, more precisely its family (see <a href="chap13.html#X846063757EC05986"><span class="RefLink">13.1</span></a>) equals the family of its collection of basis vectors.</p>

<p>Mutable bases can be constructed with <code class="code">MutableBasis</code>.</p>

<p>Similar to the situation with bases (cf. <a href="chap61.html#X828AA09B87F14FAD"><span class="RefLink">61.5</span></a>), <strong class="pkg">GAP</strong> supports the following three kinds of mutable bases.</p>

<p>The <em>generic method</em> of <code class="code">MutableBasis</code> returns a mutable basis that simply stores an immutable basis; clearly one wants to avoid this whenever possible with reasonable effort.</p>

<p>There are mutable bases that store a mutable basis for a nicer module. Note that this is meaningful only if the mechanism of computing nice and ugly vectors (see <a href="chap61.html#X81503EB77FCE648D"><span class="RefLink">61.11</span></a>) is invariant under closures of the basis; this is the case for example if the vectors are matrices, Lie objects, or elements of structure constants algebras.</p>

<p>There are mutable bases that use special information to perform their tasks; examples are mutable bases of Gaussian row and matrix spaces.</p>

<p><a id="X7F466FB47F7E9F00" name="X7F466FB47F7E9F00"></a></p>

<h5>61.8-1 IsMutableBasis</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsMutableBasis</code>( <var class="Arg">MB</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>Every mutable basis lies in the category <code class="code">IsMutableBasis</code>.</p>

<p><a id="X8115C061819E5172" name="X8115C061819E5172"></a></p>

<h5>61.8-2 MutableBasis</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ MutableBasis</code>( <var class="Arg">R</var>, <var class="Arg">vectors</var>[, <var class="Arg">zero</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="code">MutableBasis</code> returns a mutable basis for the <var class="Arg">R</var>-free module generated by the vectors in the list <var class="Arg">vectors</var>. The optional argument <var class="Arg">zero</var> is the zero vector of the module; it must be given if <var class="Arg">vectors</var> is empty.</p>

<p><em>Note</em> that <var class="Arg">vectors</var> will in general <em>not</em> be the basis vectors of the mutable basis!</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">MB:= MutableBasis( Rationals, [ [ 1, 2, 3 ], [ 0, 1, 0 ] ] );</span>
<mutable basis over Rationals, 2 vectors>
</pre></div>

<p><a id="X7EC90F4F7BCAF8D4" name="X7EC90F4F7BCAF8D4"></a></p>

<h5>61.8-3 NrBasisVectors</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NrBasisVectors</code>( <var class="Arg">MB</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>For a mutable basis <var class="Arg">MB</var>, <code class="code">NrBasisVectors</code> returns the current number of basis vectors of <var class="Arg">MB</var>. Note that this operation is <em>not</em> an attribute, as it makes no sense to store the value. <code class="code">NrBasisVectors</code> is used mainly as an equivalent of <code class="code">Dimension</code> for the underlying left module in the case of immutable bases.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">MB:= MutableBasis( Rationals, [ [ 1, 1], [ 2, 2 ] ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">NrBasisVectors( MB );</span>
1
</pre></div>

<p><a id="X7BA87512823A8CFD" name="X7BA87512823A8CFD"></a></p>

<h5>61.8-4 ImmutableBasis</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ImmutableBasis</code>( <var class="Arg">MB</var>[, <var class="Arg">V</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">ImmutableBasis</code> returns the immutable basis <span class="SimpleMath">B</span> with the same basis vectors as in the mutable basis <var class="Arg">MB</var>.</p>

<p>If the second argument <var class="Arg">V</var> is present then <var class="Arg">V</var> is the value of <code class="func">UnderlyingLeftModule</code> (<a href="chap61.html#X81E8AE88843B70FF"><span class="RefLink">61.6-2</span></a>) for <span class="SimpleMath">B</span>. The second variant is used mainly for the case that one knows the module for the desired basis in advance, and if it has a nicer structure than the module known to <var class="Arg">MB</var>, for example if it is an algebra.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">MB:= MutableBasis( Rationals, [ [ 1, 1 ], [ 2, 2 ] ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= ImmutableBasis( MB );</span>
SemiEchelonBasis( <vector space of dimension 1 over Rationals>,
[ [ 1, 1 ] ] )
<span class="GAPprompt">gap></span> <span class="GAPinput">UnderlyingLeftModule( B );</span>
<vector space of dimension 1 over Rationals>
</pre></div>

<p><a id="X85B50AC77A22108B" name="X85B50AC77A22108B"></a></p>

<h5>61.8-5 IsContainedInSpan</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsContainedInSpan</code>( <var class="Arg">MB</var>, <var class="Arg">v</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>For a mutable basis <var class="Arg">MB</var> over the coefficient ring <span class="SimpleMath">R</span> and a vector <var class="Arg">v</var>, <code class="code">IsContainedInSpan</code> returns <code class="keyw">true</code> is <var class="Arg">v</var> lies in the <span class="SimpleMath">R</span>-span of the current basis vectors of <var class="Arg">MB</var>, and <code class="keyw">false</code> otherwise.</p>

<p><a id="X7B52C99B84316F61" name="X7B52C99B84316F61"></a></p>

<h5>61.8-6 CloseMutableBasis</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ CloseMutableBasis</code>( <var class="Arg">MB</var>, <var class="Arg">v</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>For a mutable basis <var class="Arg">MB</var> over the coefficient ring <span class="SimpleMath">R</span> and a vector <var class="Arg">v</var>, <code class="func">CloseMutableBasis</code> changes <var class="Arg">MB</var> such that afterwards it describes the <span class="SimpleMath">R</span>-span of the former basis vectors together with <var class="Arg">v</var>.</p>

<p><em>Note</em> that if <var class="Arg">v</var> enlarges the dimension then this does in general <em>not</em> mean that <var class="Arg">v</var> is simply added to the basis vectors of <var class="Arg">MB</var>. Usually a linear combination of <var class="Arg">v</var> and the other basis vectors is added, and also the old basis vectors may be modified, for example in order to keep the list of basis vectors echelonized (see <code class="func">IsSemiEchelonized</code> (<a href="chap61.html#X865A540F85FAE2DF"><span class="RefLink">61.9-7</span></a>)).</p>

<p><code class="func">CloseMutableBasis</code> returns <code class="keyw">false</code> if <var class="Arg">v</var> was already in the <span class="SimpleMath">R</span>-span described by <var class="Arg">MB</var>, and <code class="keyw">true</code> if <var class="Arg">MB</var> got extended.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">MB:= MutableBasis( Rationals, [ [ 1, 1, 3 ], [ 2, 2, 1 ] ] );</span>
<mutable basis over Rationals, 2 vectors>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsContainedInSpan( MB, [ 1, 0, 0 ] );</span>
false
<span class="GAPprompt">gap></span> <span class="GAPinput">CloseMutableBasis( MB, [ 1, 0, 0 ] );</span>
true
--> --------------------

--> maximum size reached

--> --------------------

100%


¤ Dauer der Verarbeitung: 0.102 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge