|
|
|
|
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</var> form 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</var> form 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</var> form 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</var> form 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 ) );;</ | | |