Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/testing/web-platform/meta/   (Browser von der Mozilla Stiftung Version 136.0.1©) image not shown  

SSL chap26_mj.html   Sprache: HTML

 
 products/sources/formale Sprachen/GAP/doc/ref/chap26_mj.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>
<script type="text/javascript"
  src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<title>GAP (ref) - Chapter 26: Vector and Matrix Objects</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="chap26"  onload="jscontent()">


<div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0_mj.html">Top</a>  <a href="chap1_mj.html">1</a>  <a href="chap2_mj.html">2</a>  <a href="chap3_mj.html">3</a>  <a href="chap4_mj.html">4</a>  <a href="chap5_mj.html">5</a>  <a href="chap6_mj.html">6</a>  <a href="chap7_mj.html">7</a>  <a href="chap8_mj.html">8</a>  <a href="chap9_mj.html">9</a>  <a href="chap10_mj.html">10</a>  <a href="chap11_mj.html">11</a>  <a href="chap12_mj.html">12</a>  <a href="chap13_mj.html">13</a>  <a href="chap14_mj.html">14</a>  <a href="chap15_mj.html">15</a>  <a href="chap16_mj.html">16</a>  <a href="chap17_mj.html">17</a>  <a href="chap18_mj.html">18</a>  <a href="chap19_mj.html">19</a>  <a href="chap20_mj.html">20</a>  <a href="chap21_mj.html">21</a>  <a href="chap22_mj.html">22</a>  <a href="chap23_mj.html">23</a>  <a href="chap24_mj.html">24</a>  <a href="chap25_mj.html">25</a>  <a href="chap26_mj.html">26</a>  <a href="chap27_mj.html">27</a>  <a href="chap28_mj.html">28</a>  <a href="chap29_mj.html">29</a>  <a href="chap30_mj.html">30</a>  <a href="chap31_mj.html">31</a>  <a href="chap32_mj.html">32</a>  <a href="chap33_mj.html">33</a>  <a href="chap34_mj.html">34</a>  <a href="chap35_mj.html">35</a>  <a href="chap36_mj.html">36</a>  <a href="chap37_mj.html">37</a>  <a href="chap38_mj.html">38</a>  <a href="chap39_mj.html">39</a>  <a href="chap40_mj.html">40</a>  <a href="chap41_mj.html">41</a>  <a href="chap42_mj.html">42</a>  <a href="chap43_mj.html">43</a>  <a href="chap44_mj.html">44</a>  <a href="chap45_mj.html">45</a>  <a href="chap46_mj.html">46</a>  <a href="chap47_mj.html">47</a>  <a href="chap48_mj.html">48</a>  <a href="chap49_mj.html">49</a>  <a href="chap50_mj.html">50</a>  <a href="chap51_mj.html">51</a>  <a href="chap52_mj.html">52</a>  <a href="chap53_mj.html">53</a>  <a href="chap54_mj.html">54</a>  <a href="chap55_mj.html">55</a>  <a href="chap56_mj.html">56</a>  <a href="chap57_mj.html">57</a>  <a href="chap58_mj.html">58</a>  <a href="chap59_mj.html">59</a>  <a href="chap60_mj.html">60</a>  <a href="chap61_mj.html">61</a>  <a href="chap62_mj.html">62</a>  <a href="chap63_mj.html">63</a>  <a href="chap64_mj.html">64</a>  <a href="chap65_mj.html">65</a>  <a href="chap66_mj.html">66</a>  <a href="chap67_mj.html">67</a>  <a href="chap68_mj.html">68</a>  <a href="chap69_mj.html">69</a>  <a href="chap70_mj.html">70</a>  <a href="chap71_mj.html">71</a>  <a href="chap72_mj.html">72</a>  <a href="chap73_mj.html">73</a>  <a href="chap74_mj.html">74</a>  <a href="chap75_mj.html">75</a>  <a href="chap76_mj.html">76</a>  <a href="chap77_mj.html">77</a>  <a href="chap78_mj.html">78</a>  <a href="chap79_mj.html">79</a>  <a href="chap80_mj.html">80</a>  <a href="chap81_mj.html">81</a>  <a href="chap82_mj.html">82</a>  <a href="chap83_mj.html">83</a>  <a href="chap84_mj.html">84</a>  <a href="chap85_mj.html">85</a>  <a href="chap86_mj.html">86</a>  <a href="chap87_mj.html">87</a>  <a href="chapBib_mj.html">Bib</a>  <a href="chapInd_mj.html">Ind</a>  </div>

<div class="chlinkprevnexttop"> <a href="chap0_mj.html">[Top of Book]</a>   <a href="chap0_mj.html#contents">[Contents]</a>    <a href="chap25_mj.html">[Previous Chapter]</a>    <a href="chap27_mj.html">[Next Chapter]</a>   </div>

<p id="mathjaxlink" class="pcenter"><a href="chap26.html">[MathJax off]</a></p>
<p><a id="X856C23B87E50F118" name="X856C23B87E50F118"></a></p>
<div class="ChapSects"><a href="chap26_mj.html#X856C23B87E50F118">26 <span class="Heading">Vector and Matrix Objects</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X7A7275C27EC61ACE">26.1 <span class="Heading">Concepts and Rules for Vector and Matrix Objects</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X7C6CDBFE7EB083A5">26.2 <span class="Heading">Categories of Vector and Matrix Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7D963FCC7E849BE0">26.2-1 IsVectorObj</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7E7617A0781D1E4B">26.2-2 IsMatrixObj</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7D1ACCBE7E9CF501">26.2-3 IsMatrixOrMatrixObj</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X78CD88A283330E72">26.2-4 IsRowListMatrix</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X877A706186C89ADB">26.3 <span class="Heading">Defining Attributes of Vector and Matrix Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X8662026C7CCDB446">26.3-1 <span class="Heading">BaseDomain</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X85ABF33684865ED5">26.3-2 <span class="Heading">ConstructingFilter</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X818702FD7A2E9D90">26.3-3 <span class="Heading">CompatibleVectorFilter</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X828BA5E1849E3D06">26.3-4 Length</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X820ED34380C10E19">26.3-5 <span class="Heading">NumberRows and NumberColumns</span></a>
</span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X7BD7D2837BFDE649">26.4 <span class="Heading">Constructing Vector and Matrix Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X860E84397BD148E9">26.4-1 <span class="Heading">NewVector and NewZeroVector</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X79A6544D86261E82">26.4-2 <span class="Heading">Vector</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7DBA8BF5844F3281">26.4-3 <span class="Heading">ZeroVector</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7AD2210B8047FB01">26.4-4 <span class="Heading">NewMatrix, NewZeroMatrix, NewIdentityMatrix</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X879384D479EB1D82">26.4-5 <span class="Heading">Matrix</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X838F5B6C7C87C8E1">26.4-6 <span class="Heading">ZeroMatrix</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7D807ABC7FCB4E77">26.4-7 <span class="Heading">IdentityMatrix</span></a>
</span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X7C7F5250855C4371">26.5 <span class="Heading">Operations for Base Domains of Vector and Matrix Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X85D7A6A782B21E5C">26.5-1 <span class="Heading">OneOfBaseDomain and ZeroOfBaseDomain</span></a>
</span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X7954E20987E0B260">26.6 <span class="Heading">Operations for Vector and Matrix Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7FFC60A27FE6FA97">26.6-1 <span class="Heading">Comparison of Vector and Matrix Objects</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7FBBE79478012648">26.6-2 <span class="Heading">Unpack</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X85E896F67CE2F925">26.6-3 <span class="Heading">ChangedBaseDomain</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X83DD8B39864A2C94">26.6-4 <span class="Heading">Randomize</span></a>
</span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X7FE662477F36A21F">26.7 <span class="Heading">List Like Operations for Vector Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7D5DF49C7ADB6986">26.7-1 <span class="Heading">Element Access and Assignment for Vector Objects</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7A21731C83EE3BB0">26.7-2 PositionNonZero</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7ABDE1B685A78326">26.7-3 PositionLastNonZero</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X790013817E314B2D">26.7-4 ListOp</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X7FDF7655852AEAAE">26.8 <span class="Heading">Arithmetical Operations for Vector Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7F8CE23F7A250072">26.8-1 <span class="Heading">Unary Arithmetical Operations for Vector Objects</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X85A815CA790094CC">26.8-2 <span class="Heading">Binary Arithmetical Operations for Vector Objects</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X876090A684E71C93">26.8-3 AddVector</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X8039D013817317C3">26.8-4 MultVector</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X7BE9D278852C13BC">26.9 <span class="Heading">Operations for Vector Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7AC470557EC90714">26.9-1 <span class="Heading">ConcatenationOfVectors</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7DBE956E7F9C700E">26.9-2 ExtractSubVector</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X80EC354D78D7B5A6">26.9-3 CopySubVector</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X866366E587991171">26.9-4 WeightOfVector</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X81ACAE017C00F782">26.9-5 DistanceOfVectors</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X81CC13CA7A1FF4AA">26.10 <span class="Heading">Arithmetical Operations for Matrix Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X819F87A07DA7E2DC">26.10-1 <span class="Heading">Unary Arithmetical Operations for Matrix Objects</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7BBB70557A7A9591">26.10-2 <span class="Heading">Binary Arithmetical Operations for Matrix Objects</span></a>
</span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X85FAB7E778A71C19">26.11 <span class="Heading">Operations for Matrix Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X870FBE817C884AB5">26.11-1 MatElm</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7C33059984635480">26.11-2 SetMatElm</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X838B45F7790E9FDF">26.11-3 ExtractSubMatrix</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X793CD4637F237915">26.11-4 MutableCopyMatrix</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7ED9E5D4809E3B50">26.11-5 CopySubMatrix</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X809A6B3F7EA5E7D8">26.11-6 CompatibleVector</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7EE70D5A81E9ED72">26.11-7 RowsOfMatrix</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7E06762479A00DF4">26.11-8 <span class="Heading">CompanionMatrix</span></a>
</span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X7D40EE2084A6C976">26.12 <span class="Heading">Operations for Row List Matrix Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X82C4FCFA808010F8">26.12-1 <span class="Heading">List Access for a Row List Matrix</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7F89BB2482D28AAE">26.12-2 <span class="Heading">List Assignment for a Row List Matrix</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X807518367C96516F">26.12-3 <span class="Heading">Sublist Access for a Row List Matrix</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X8371789181FA136B">26.12-4 <span class="Heading">Sublist Assignment for a Row List Matrix</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X872E63867803ED78"><code>26.12-5 IsBound<span>\</span>[<span>\</span>]</code></a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X79328CB280C71DDB"><code>26.12-6 Unbind<span>\</span>[<span>\</span>]</code></a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7BDD838579E4D2D6">26.12-7 Add</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X86E355D07A41C025">26.12-8 Remove</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X82D0359B81F8D442">26.12-9 Append</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7E234F717BE333EA">26.12-10 ShallowCopy</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7E9F095E85DED480">26.12-11 ListOp</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X7B86A8487B12F9BD">26.13 <span class="Heading">Basic operations for row/column reductions</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7B3997D37CC44FCA">26.13-1 MultMatrixRowLeft</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X794636447E8C5553">26.13-2 MultMatrixRowRight</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X80AF7B267E6B9CE0">26.13-3 MultMatrixColumnRight</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X843DAFE37F347471">26.13-4 MultMatrixColumnLeft</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X8662EB748629502F">26.13-5 AddMatrixRowsLeft</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7CD05EE984614AB6">26.13-6 AddMatrixRowsRight</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7B1E1E417CA267A3">26.13-7 AddMatrixColumnsRight</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X85ECB8C87DFD8F32">26.13-8 AddMatrixColumnsLeft</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X87CCA3117F6B3F0D">26.13-9 SwapMatrixRows</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X824C8A347EB9D499">26.13-10 SwapMatrixColumns</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X7BEE647484978886">26.14 <span class="Heading">Implementing New Vector and Matrix Objects Types</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X82EEE1D37A94F807">26.15 <span class="Heading">Available Representations of Vector Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7C8050938691A914">26.15-1 IsGF2VectorRep</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X82A643007EC6D1CA">26.15-2 Is8BitVectorRep</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X83262B7085FA94E3">26.15-3 IsPlistVectorRep</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X8730DB7D7E7DA883">26.15-4 IsZmodnZVectorRep</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap26_mj.html#X7CFD844C7D80D541">26.16 <span class="Heading">Available Representations of Matrix Objects</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X7F6078FF81E912E7">26.16-1 IsGF2MatrixRep</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X81466B6C7CAC3A7B">26.16-2 Is8BitMatrixRep</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X80C6031C7DB31A15">26.16-3 IsPlistMatrixRep</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap26_mj.html#X84D0F3117DA86850">26.16-4 IsZmodnZMatrixRep</a></span>
</div></div>
</div>

<h3>26 <span class="Heading">Vector and Matrix Objects</span></h3>

<p>This chapter describes an interface to vector and matrix objects which are not represented by plain lists (of plain lists), cf. Chapters <a href="chap23_mj.html#X82C7E6CF7BA03391"><span class="RefLink">23</span></a> and <a href="chap24_mj.html#X812CCAB278643A59"><span class="RefLink">24</span></a>.</p>

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

<h4>26.1 <span class="Heading">Concepts and Rules for Vector and Matrix Objects</span></h4>

<p>Traditionally, vectors and matrices in <strong class="pkg">GAP</strong> have been represented by (lists of) lists, see the chapters <a href="chap23_mj.html#X82C7E6CF7BA03391"><span class="RefLink">23</span></a> and <a href="chap24_mj.html#X812CCAB278643A59"><span class="RefLink">24</span></a>. More precisely, the term <q>vector</q> (corresponding to the filter <code class="func">IsVector</code> (<a href="chap31_mj.html#X802F34F280B29DF4"><span class="RefLink">31.14-14</span></a>)) is used in the abstract sense of an <q>element of a vector space</q>, the term <q>row vector</q> (corresponding to <code class="func">IsRowVector</code> (<a href="chap23_mj.html#X7DFB22A07836A7A9"><span class="RefLink">23.1-1</span></a>)) is used to denote a <q>coordinate vector</q> which is represented by a <strong class="pkg">GAP</strong> list (see <code class="func">IsList</code> (<a href="chap21_mj.html#X7C4CC4EA8299701E"><span class="RefLink">21.1-1</span></a>)), and the term <q>matrix</q> is used to denote a list of lists, with additional properties (see <code class="func">IsMatrix</code> (<a href="chap24_mj.html#X7E1AE46B862B185F"><span class="RefLink">24.2-1</span></a>)).</p>

<p>Unfortunately, such lists (objects in <code class="func">IsPlistRep</code> (<a href="chap21_mj.html#X87BA4EBF80F16B72"><span class="RefLink">21.24-2</span></a>)) cannot store their type, and so it is impossible to use the advantages of <strong class="pkg">GAP</strong>'s method selection on them. This situation is unsustainable in the long run since more special representations (compressed, sparse, etc.) have already been and even more will be implemented. Here we describe a programming interface to vectors and matrices, which solves this problem,



<p>The idea of this interface is that <strong class="pkg">GAP</strong> should be able to represent vectors and matrices by objects that store their type, in order to benefit from method selection. These objects are created by <code class="func">Objectify</code> (<a href="chap79_mj.html#X7CB5C12E813F512B"><span class="RefLink">79.1-1</span></a>), we therefore refer to the them as <q>vector objects</q> and <q>matrix objects</q> respectively.</p>

<p>(Of course the terminology is somewhat confusing: An <q>abstract matrix</q> in <strong class="pkg">GAP</strong> can be represented either by a list of lists or by a matrix object. It can be detected from the filter <code class="func">IsMatrixOrMatrixObj</code> (<a href="chap26_mj.html#X7D1ACCBE7E9CF501"><span class="RefLink">26.2-3</span></a>); this is the union of the filters <code class="func">IsMatrix</code> (<a href="chap24_mj.html#X7E1AE46B862B185F"><span class="RefLink">24.2-1</span></a>) –which denotes those matrices that are represented by lists of lists– and the filter <code class="func">IsMatrixObj</code> (<a href="chap26_mj.html#X7E7617A0781D1E4B"><span class="RefLink">26.2-2</span></a>) –which defines <q>proper</q> matrix objects in the above sense. In particular, we do <em>not</em> regard the objects in <code class="func">IsMatrix</code> (<a href="chap24_mj.html#X7E1AE46B862B185F"><span class="RefLink">24.2-1</span></a>) as special cases of objects in <code class="func">IsMatrixObj</code> (<a href="chap26_mj.html#X7E7617A0781D1E4B"><span class="RefLink">26.2-2</span></a>), or vice versa. Thus one can install specific methods for all three situations: just for <q>proper</q> matrix objects, just for matrices represented by lists of lists, or for both kinds of matrices. For example, a <strong class="pkg">GAP</strong> package may decide to accept only <q>proper</q> matrix objects as arguments of its functions, or it may try to support also objects in <code class="func">IsMatrix</code> (<a href="chap24_mj.html#X7E1AE46B862B185F"><span class="RefLink">24.2-1</span></a>) as far as this is possible.)</p>

<p>We want to be able to write (efficient) code that is independent of the actual representation (in the sense of <strong class="pkg">GAP</strong>'s representation filters, see Section 13.4) and preserves it.



<p>This latter requirement makes it necessary to distinguish between different representations of matrices: <q>Row list</q> matrices (see <code class="func">IsRowListMatrix</code> (<a href="chap26_mj.html#X78CD88A283330E72"><span class="RefLink">26.2-4</span></a>) behave basically like lists of rows, in particular the rows are individual <strong class="pkg">GAP</strong> objects that can be shared between different matrix objects. One can think of other representations of matrices, such as matrices whose subobjects represent columns, or <q>flat</q> matrices which do not have subobjects like rows or columns at all. The different kinds of matrices have to be distinguished already with respect to the definition of the operations for them.</p>

<p>In particular vector and matrix objects know their base domain (see <code class="func">BaseDomain</code> (<a href="chap26_mj.html#X8662026C7CCDB446"><span class="RefLink">26.3-1</span></a>)) and their dimensions. The basic condition is that the entries of vector and matrix objects must either lie in the base domain or naturally embed in the sense that addition and multiplication automatically work with elements of the base domain; for example, a matrix object over a polynomial ring may also contain entries from the coefficient ring.</p>

<p>Vector and matrix objects may be mutable or immutable. Of course all operations changing an object are only allowed/implemented for mutable variants.</p>

<p>Vector objects are equal with respect to <code class="func">\=</code> (<a href="chap31_mj.html#X7EF67D047F03CA6F"><span class="RefLink">31.11-1</span></a>) if they have the same length and the same entries. It is not necessary that they have the same base domain. Matrices are equal with respect to <code class="func">\=</code> (<a href="chap31_mj.html#X7EF67D047F03CA6F"><span class="RefLink">31.11-1</span></a>) if they have the same dimensions and the same entries.</p>

<p>For a row list matrix object, it is not guaranteed that all its rows have the same vector type. It is for example thinkable that a matrix object stores some of its rows in a sparse representation and some in a dense one. However, it is guaranteed that the rows of two matrices in the same representation are compatible in the sense that all vector operations defined in this interface can be applied to them and that new matrices in the same representation as the original matrix can be formed out of them.</p>

<p>Note that there is neither a default mapping from the set of matrix object representations to the set of vector representations nor one in the reverse direction. There is in general no <q>associated</q> vector object representation to a matrix object representation or vice versa. (However, <code class="func">CompatibleVectorFilter</code> (<a href="chap26_mj.html#X818702FD7A2E9D90"><span class="RefLink">26.3-3</span></a>) may describe a vector object representation that is compatible with a given matrix object.)</p>

<p>The recommended way to write code that preserves the representation basically works by using constructing operations that take template objects to decide about the intended representation for the new object.</p>

<p>Vector and matrix objects do not have to be <strong class="pkg">GAP</strong> lists in the sense of <code class="func">IsList</code> (<a href="chap21_mj.html#X7C4CC4EA8299701E"><span class="RefLink">21.1-1</span></a>). Note that objects not in the filter <code class="func">IsList</code> (<a href="chap21_mj.html#X7C4CC4EA8299701E"><span class="RefLink">21.1-1</span></a>) need not support all list operations, and their behaviour is not prescribed by the rules for lists, e.g., behaviour w.r.t. arithmetic operations. However, row list matrices behave nearly like lists of row vectors that insist on being dense and containing only vectors of the same length and with the sambase domain.</p>

<p>Vector and matrix objects are not likely to benefit from <strong class="pkg">GAP</strong>'s immediate methods (see section 78.7). Therefore it may be useful to set the filter IsNoImmediateMethodsObject (78.7-2) in the definition of new kinds of vector and matrix objects.



<p>For information on how to implement new <code class="func">IsMatrixObj</code> (<a href="chap26_mj.html#X7E7617A0781D1E4B"><span class="RefLink">26.2-2</span></a>) and <code class="func">IsVectorObj</code> (<a href="chap26_mj.html#X7D963FCC7E849BE0"><span class="RefLink">26.2-1</span></a>) representations see Section <a href="chap26_mj.html#X7BEE647484978886"><span class="RefLink">26.14</span></a>.</p>

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

<h4>26.2 <span class="Heading">Categories of Vector and Matrix Objects</span></h4>

<p>Currently the following categories of vector and matrix objects are supported in <strong class="pkg">GAP</strong>. More can be added as soon as there is need for them.</p>

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

<h5>26.2-1 IsVectorObj</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsVectorObj</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>The idea behind <em>vector objects</em> is that one wants to deal with objects like coefficient lists of fixed length over a given domain <span class="SimpleMath">\(R\)</span>, say, which can be added and can be multiplied from the left with elements from <span class="SimpleMath">\(R\)</span>. A vector object <span class="SimpleMath">\(v\)</span>, say, is always a copyable object (see <code class="func">IsCopyable</code> (<a href="chap12_mj.html#X811EFD727EBD1ADC"><span class="RefLink">12.6-1</span></a>)) in <code class="func">IsVector</code> (<a href="chap31_mj.html#X802F34F280B29DF4"><span class="RefLink">31.14-14</span></a>), which knows the values of <code class="func">BaseDomain</code> (<a href="chap26_mj.html#X8662026C7CCDB446"><span class="RefLink">26.3-1</span></a>) (with value <span class="SimpleMath">\(R\)</span>) and <code class="func">Length</code> (<a href="chap21_mj.html#X780769238600AFD1"><span class="RefLink">21.17-5</span></a>), where <span class="SimpleMath">\(R\)</span> is a domain (see Chapter <a href="chap12_mj.html#X7BAF69417BB925F6"><span class="RefLink">12.4</span></a>) that has methods for <code class="func">Zero</code> (<a href="chap31_mj.html#X8040AC7A79FFC442"><span class="RefLink">31.10-3</span></a>), <code class="func">One</code> (<a href="chap31_mj.html#X8046262384895B2A"><span class="RefLink">31.10-2</span></a>), <code class="func">\in</code> (<a href="chap30_mj.html#X84B7FA8C7C94400F"><span class="RefLink">30.6-1</span></a>), <code class="func">Characteristic</code> (<a href="chap31_mj.html#X81278E53800BF64D"><span class="RefLink">31.10-1</span></a>), <code class="func">IsFinite</code> (<a href="chap30_mj.html#X808A4061809A6E67"><span class="RefLink">30.4-2</span></a>). We say that <span class="SimpleMath">\(v\)</span> is defined over <span class="SimpleMath">\(R\)</span>. Typically, <span class="SimpleMath">\(R\)</span> will be at least a semiring.</p>

<p>For creating new vector objects compatible with <span class="SimpleMath">\(v\)</span>, <code class="func">NewVector</code> (<a href="chap26_mj.html#X860E84397BD148E9"><span class="RefLink">26.4-1</span></a>) requires that also the value of <code class="func">ConstructingFilter</code> (<a href="chap26_mj.html#X85ABF33684865ED5"><span class="RefLink">26.3-2</span></a>) is known for <span class="SimpleMath">\(v\)</span>.</p>

<p>Further, entry access <span class="SimpleMath">\(v[i]\)</span> is expected to return a <strong class="pkg">GAP</strongobject, for <span class="SimpleMath">\(1 \leq i \leq\)</span><code class="code"> Length</code><span class="SimpleMath">\(( v )\)</span>, and that these entries of <span class="SimpleMath">\(v\)</span> belong to the base domain <span class="SimpleMath">\(R\)</span>.</p>

<p>Note that we do <em>not</em> require that <span class="SimpleMath">\(v\)</span> is a list in the sense of <code class="func">IsList</code> (<a href="chap21_mj.html#X7C4CC4EA8299701E"><span class="RefLink">21.1-1</span></a>), in particular the rules of list arithmetic (see the sections <a href="chap21_mj.html#X7E6A1F66781BE923"><span class="RefLink">21.13</span></a> and <a href="chap21_mj.html#X782ED7F27D8C7FC1"><span class="RefLink">21.14</span></a>) need <em>not</em> hold. For example, the sum of two vector objects of different lengths or defined over different base domains is not defined, and a plain list of vector objects is not a matrix. Also unbinding entries of vector objects is not defined.</p>

<p>Scalar multiplication from the left is defined only with elements from <span class="SimpleMath">\(R\)</span>.</p>

<p>The family of <span class="SimpleMath">\(v\)</span> (see <code class="func">FamilyObj</code> (<a href="chap13_mj.html#X7CF70EAC84284919"><span class="RefLink">13.1-1</span></a>)) is the same as the family of its base domain <span class="SimpleMath">\(R\)</span>. However, it is <em>not</em> required that the entries lie in <span class="SimpleMath">\(R\)</span> in the sense of <code class="func">\in</code> (<a href="chap30_mj.html#X84B7FA8C7C94400F"><span class="RefLink">30.6-1</span></a>), also values may occur that can be naturally embedded into <span class="SimpleMath">\(R\)</span>. For example, if <span class="SimpleMath">\(R\)</span> is a polynomial ring then some entries in <span class="SimpleMath">\(v\)</span> may be elements of the coefficient ring of <span class="SimpleMath">\(R\)</span>.</p>

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

<h5>26.2-2 IsMatrixObj</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsMatrixObj</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>The idea behind <em>matrix objects</em> is that one wants to deal with objects like <span class="SimpleMath">\(m\)</span> by <span class="SimpleMath">\(n\)</span> arrays over a given domain <span class="SimpleMath">\(R\)</span>, say, which can be added and multiplied and can be multiplied from the left with elements from <span class="SimpleMath">\(R\)</span>. A matrix object <span class="SimpleMath">\(M\)</span>, say, is always a copyable object (see <code class="func">IsCopyable</code> (<a href="chap12_mj.html#X811EFD727EBD1ADC"><span class="RefLink">12.6-1</span></a>)) in <code class="func">IsVector</code> (<a href="chap31_mj.html#X802F34F280B29DF4"><span class="RefLink">31.14-14</span></a>) and <code class="func">IsScalar</code> (<a href="chap31_mj.html#X8113834E84FD0435"><span class="RefLink">31.14-20</span></a>), which knows the values of <code class="func">BaseDomain</code> (<a href="chap26_mj.html#X8662026C7CCDB446"><span class="RefLink">26.3-1</span></a>) (with value <span class="SimpleMath">\(R\)</span>), <code class="func">NumberRows</code> (<a href="chap26_mj.html#X820ED34380C10E19"><span class="RefLink">26.3-5</span></a>) (with value <span class="SimpleMath">\(m\)</span>), <code class="func">NumberColumns</code> (<a href="chap26_mj.html#X820ED34380C10E19"><span class="RefLink">26.3-5</span></a>) (with value <span class="SimpleMath">\(n\)</span>), where <span class="SimpleMath">\(R\)</span> is a domain (see Chapter <a href="chap12_mj.html#X7BAF69417BB925F6"><span class="RefLink">12.4</span></a>) that has methods for <code class="func">Zero</code> (<a href="chap31_mj.html#X8040AC7A79FFC442"><span class="RefLink">31.10-3</span></a>), <code class="func">One</code> (<a href="chap31_mj.html#X8046262384895B2A"><span class="RefLink">31.10-2</span></a>), <code class="func">\in</code(<a href="chap30_mj.html#X84B7FA8C7C94400F"><span class="RefLink">30.6-1</span></a>), <code class="func">Characteristic</code> (<a href="chap31_mj.html#X81278E53800BF64D"><span class="RefLink">31.10-1</span></a>), <code class="func">IsFinite</code> (<a href="chap30_mj.html#X808A4061809A6E67"><span class="RefLink">30.4-2</span></a>). We say that <span class="SimpleMath">\(v\)</span> is defined over <span class="SimpleMath">\(R\)</span>. Typically, <span class="SimpleMath">\(R\)</span> will be at least a semiring.</p>

<p>For creating new matrix objects compatible with <span class="SimpleMath">\(M\)</span>, <code class="func">NewMatrix</code> (<a href="chap26_mj.html#X7AD2210B8047FB01"><span class="RefLink">26.4-4</span></a>) requires that also the value of <code class="func">ConstructingFilter</code> (<a href="chap26_mj.html#X85ABF33684865ED5"><span class="RefLink">26.3-2</span></a>) is known for <span class="SimpleMath">\(M\)</span>.</p>

<p>Further, entry access <span class="SimpleMath">\(M[i,j]\)</span> is expected to return a <strong class="pkg">GAP</strongobject, for <span class="SimpleMath">\(1 \leq i \leq m\)</span> and <span class="SimpleMath">\(1 \leq j \leq n\)</span>, and that these entries of <span class="SimpleMath">\(M\)</span> belong to the base domain <span class="SimpleMath">\(R\)</span>.</p>

<p>Note that we do <em>not</em> require that <span class="SimpleMath">\(M\)</span> is a list in the sense of <code class="func">IsList</code> (<a href="chap21_mj.html#X7C4CC4EA8299701E"><span class="RefLink">21.1-1</span></a>), in particular the rules of list arithmetic (see the sections <a href="chap21_mj.html#X7E6A1F66781BE923"><span class="RefLink">21.13</span></a> and <a href="chap21_mj.html#X782ED7F27D8C7FC1"><span class="RefLink">21.14</span></a>) need <em>not</em> hold. For example, accessing <q>rows</q> of <span class="SimpleMath">\(M\)</span> via <code class="func"><span>\</span>[<span>\</span>]</code> (<a href="chap21_mj.html#X8297BBCD79642BE6"><span class="RefLink">21.2-1</span></a>) is in general not possible, and the sum of two matrix objects with different numbers of rows or columns is not defined. Also unbinding entries of matrix objects is not defined.</p>

<p>Scalar multiplication from the left is defined only with elements from <span class="SimpleMath">\(R\)</span>.</p>

<p>It is not assumed that the multiplication in <span class="SimpleMath">\(R\)</span> is associative, and we do not define what the <span class="SimpleMath">\(k\)</span>-th power of a matrix object is in this case, for positive integers <span class="SimpleMath">\(k\)</span>. (However, a default powering method is available.)</p>

<p>The filter <code class="func">IsMatrixObj</code> alone does <em>not</em> imply that the multiplication is the usual matrix multiplication. This multiplication can be defined via the filter <code class="func">IsOrdinaryMatrix</code> (<a href="chap24_mj.html#X7CF42B8A845BC6A9"><span class="RefLink">24.2-2</span></a>); this filter together with the associativity of the base domain also implies the associativity of matrix multiplication. For example, elements of matrix Lie algebras (see <code class="func">LieObject</code> (<a href="chap64_mj.html#X87F121978775AF48"><span class="RefLink">64.1-1</span></a>)) lie in <code class="func">IsMatrixObj</code> but not in <code class="func">IsOrdinaryMatrix</code> (<a href="chap24_mj.html#X7CF42B8A845BC6A9"><span class="RefLink">24.2-2</span></a>).</p>

<p>The family of <span class="SimpleMath">\(M\)</span> (see <code class="func">FamilyObj</code> (<a href="chap13_mj.html#X7CF70EAC84284919"><span class="RefLink">13.1-1</span></a>)) is the collections family (see <code class="func">CollectionsFamily</code> (<a href="chap30_mj.html#X84E5A67E87D8DD66"><span class="RefLink">30.2-1</span></a>)) of its base domain <span class="SimpleMath">\(R\)</span>. However, it is <em>not</em> required that the entries lie in <span class="SimpleMath">\(R\)</span> in the sense of <code class="func">\in</code> (<a href="chap30_mj.html#X84B7FA8C7C94400F"><span class="RefLink">30.6-1</span></a>), also values may occur that can be naturally embedded into <span class="SimpleMath">\(R\)</span>. For example, if <span class="SimpleMath">\(R\)</span> is a polynomial ring then some entries in <span class="SimpleMath">\(M\)</span> may be elements of the coefficient ring of <span class="SimpleMath">\(R\)</span>.</p>

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

<h5>26.2-3 IsMatrixOrMatrixObj</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsMatrixOrMatrixObj</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>Several functions are defined for objects in <code class="func">IsMatrix</code> (<a href="chap24_mj.html#X7E1AE46B862B185F"><span class="RefLink">24.2-1</span></a>) and objects in <code class="func">IsMatrixObj</code> (<a href="chap26_mj.html#X7E7617A0781D1E4B"><span class="RefLink">26.2-2</span></a>). All these objects lie in the filter <code class="func">IsMatrixOrMatrixObj</code>. It should be used in situations where an object can be either a list of lists in <code class="func">IsMatrix</code> (<a href="chap24_mj.html#X7E1AE46B862B185F"><span class="RefLink">24.2-1</span></a>) or a <q>proper</q> matrix object in <code class="func">IsMatrixObj</code> (<a href="chap26_mj.html#X7E7617A0781D1E4B"><span class="RefLink">26.2-2</span></a>), for example as a requirement in the installation of a method for such an argument.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">m:= IdentityMat( 2, GF(2) );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsMatrix( m );  IsMatrixObj( m ); IsMatrixOrMatrixObj( m );</span>
true
false
true
<span class="GAPprompt">gap></span> <span class="GAPinput">m:= NewIdentityMatrix( IsPlistMatrixRep, GF(2), 2 );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsMatrix( m );  IsMatrixObj( m ); IsMatrixOrMatrixObj( m );</span>
false
true
true
</pre></div>

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

<h5>26.2-4 IsRowListMatrix</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsRowListMatrix</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>A <em>row list matrix object</em> is a matrix object (see <code class="func">IsMatrixObj</code> (<a href="chap26_mj.html#X7E7617A0781D1E4B"><span class="RefLink">26.2-2</span></a>)) <span class="SimpleMath">\(M\)</span> which admits access to its rows, that is, list access <span class="SimpleMath">\(M[i]\)</span> (see <code class="func"><span>\</span>[<span>\</span>]</code> (<a href="chap21_mj.html#X8297BBCD79642BE6"><span class="RefLink">21.2-1</span></a>)) yields the <span class="SimpleMath">\(i\)</span>-th row of <span class="SimpleMath">\(M\)</span>, for <span class="SimpleMath">\(1 \leq i \leq\)</span> <code class="code">NumberRows( </code><span class="SimpleMath">\(M\)</span><code class="code"> )</code>.</p>

<p>All rows are <code class="func">IsVectorObj</code> (<a href="chap26_mj.html#X7D963FCC7E849BE0"><span class="RefLink">26.2-1</span></a>) objects in the same representation. Several rows of a row list matrix object can be identical objects, and different row list matrices may share rows. Row access just gives a reference to the row object, without copying the row.</p>

<p>Matrix objects in <code class="func">IsRowListMatrix</code> are <em>not</em> necessarily in <code class="func">IsList</code> (<a href="chap21_mj.html#X7C4CC4EA8299701E"><span class="RefLink">21.1-1</span></a>), and then they need not obey the general rules for lists.</p>

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

<h4>26.3 <span class="Heading">Defining Attributes of Vector and Matrix Objects</span></h4>

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

<h5>26.3-1 <span class="Heading">BaseDomain</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ BaseDomain</code>( <var class="Arg">vector</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">‣ BaseDomain</code>( <var class="Arg">matrix</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>The vector object <var class="Arg">vector</var> or matrix object <var class="Arg">matrix</var>, respectively, is defined over the domain given by its <code class="func">BaseDomain</code> value.</p>

<p>Note that not all entries of the object necessarily lie in its base domain with respect to <code class="func">\in</code> (<a href="chap30_mj.html#X84B7FA8C7C94400F"><span class="RefLink">30.6-1</span></a>), see Section <a href="chap26_mj.html#X7A7275C27EC61ACE"><span class="RefLink">26.1</span></a>.</p>

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

<h5>26.3-2 <span class="Heading">ConstructingFilter</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ConstructingFilter</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">‣ ConstructingFilter</code>( <var class="Arg">M</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>Returns: a filter</p>

<p>Called with a vector object <var class="Arg">v</var> or a matrix object <var class="Arg">M</var>, respectively, <code class="func">ConstructingFilter</code> returns a filter <code class="code">f</code> such that when <code class="func">NewVector</code> (<a href="chap26_mj.html#X860E84397BD148E9"><span class="RefLink">26.4-1</span></a>) or <code class="func">NewMatrix</code> (<a href="chap26_mj.html#X7AD2210B8047FB01"><span class="RefLink">26.4-4</span></a>), respectively, is called with <code class="code">f</code> then a vector object or a matrix object, respectively, in the same representation as the argument is produced.</p>

<p>If the <code class="func">ConstructingFilter</code> value of <var class="Arg">v</var> or <var class="Arg">M</var> implies <code class="func">IsCopyable</code> (<a href="chap12_mj.html#X811EFD727EBD1ADC"><span class="RefLink">12.6-1</span></a>) then mutable versions of <var class="Arg">v</var> or <var class="Arg">M</var> can be created, otherwise all vector or matrix objects with this filter are immutable.</p>

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

<h5>26.3-3 <span class="Heading">CompatibleVectorFilter</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ CompatibleVectorFilter</code>( <var class="Arg">M</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>Returns: a filter</p>

<p>Called with a matrix object <var class="Arg">M</var>, <code class="func">CompatibleVectorFilter</code> returns either a filter <code class="code">f</code> such that vector objects with <code class="func">ConstructingFilter</code> (<a href="chap26_mj.html#X85ABF33684865ED5"><span class="RefLink">26.3-2</span></a>) value <code class="code">f</code> are compatible in the sense that <var class="Arg">M</var> can be multiplied with these vector objects, of <code class="keyw">fail</code> if no such filter is known.</p>

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

<h5>26.3-4 Length</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Length</code>( <var class="Arg">v</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>returns the length of the vector object <var class="Arg">v</var>, which is defined to be the number of entries of <var class="Arg">v</var>.</p>

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

<h5>26.3-5 <span class="Heading">NumberRows and NumberColumns</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NumberRows</code>( <var class="Arg">M</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">‣ NrRows</code>( <var class="Arg">M</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">‣ NumberColumns</code>( <var class="Arg">M</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">‣ NrCols</code>( <var class="Arg">M</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>For a matrix object <var class="Arg">M</var>, <code class="func">NumberRows</code> and <code class="func">NumberColumns</code> store the number of rows and columns of <var class="Arg">M</var>, respectively.</p>

<p><code class="func">NrRows</code> and <code class="func">NrCols</code> are synonyms of <code class="func">NumberRows</code> and <code class="func">NumberColumns</code>, respectively.</p>

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

<h4>26.4 <span class="Heading">Constructing Vector and Matrix Objects</span></h4>

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

<h5>26.4-1 <span class="Heading">NewVector and NewZeroVector</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NewVector</code>( <var class="Arg">filt</var>, <var class="Arg">R</var>, <var class="Arg">list</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">‣ NewZeroVector</code>( <var class="Arg">filt</var>, <var class="Arg">R</var>, <var class="Arg">n</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>For a filter <var class="Arg">filt</var>, a semiring <var class="Arg">R</var>, and a list <var class="Arg">list</var> of elements that belong to <var class="Arg">R</var>, <code class="func">NewVector</code> returns a vector object which has the <code class="func">ConstructingFilter</code> (<a href="chap26_mj.html#X85ABF33684865ED5"><span class="RefLink">26.3-2</span></a>) <var class="Arg">filt</var>, the <code class="func">BaseDomain</code> (<a href="chap26_mj.html#X8662026C7CCDB446"><span class="RefLink">26.3-1</span></a>) <var class="Arg">R</var>, and the entries in <var class="Arg">list</var>. The list <var class="Arg">list</var> is guaranteed not to be changed by this operation.</p>

<p>If the global option <code class="code">check</code> is set to <code class="keyw">false</code> then <code class="func">NewVector</code> need not perform consistency checks.</p>

<p>Similarly, <code class="func">NewZeroVector</code> returns a vector object of length <var class="Arg">n</var> which has <var class="Arg">filt</var> and <var class="Arg">R</var> as <code class="func">ConstructingFilter</code> (<a href="chap26_mj.html#X85ABF33684865ED5"><span class="RefLink">26.3-2</span></a>) and <code class="func">BaseDomain</code> (<a href="chap26_mj.html#X8662026C7CCDB446"><span class="RefLink">26.3-1</span></a>) values, and contains the zero of <var class="Arg">R</var> in each position.</p>

<p>The returned object is mutable if and only if <var class="Arg">filt</var> implies <code class="func">IsCopyable</code> (<a href="chap12_mj.html#X811EFD727EBD1ADC"><span class="RefLink">12.6-1</span></a>).</p>

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

<h5>26.4-2 <span class="Heading">Vector</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Vector</code>( <var class="Arg">filt</var>, <var class="Arg">R</var>, <var class="Arg">list</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">‣ Vector</code>( <var class="Arg">filt</var>, <var class="Arg">R</var>, <var class="Arg">v</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">‣ Vector</code>( <var class="Arg">R</var>, <var class="Arg">list</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">‣ Vector</code>( <var class="Arg">R</var>, <var class="Arg">v</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">‣ Vector</code>( <var class="Arg">list</var>, <var class="Arg">v</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">‣ Vector</code>( <var class="Arg">v1</var>, <var class="Arg">v2</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">‣ Vector</code>( <var class="Arg">list</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: a vector object</p>

<p>If a filter <var class="Arg">filt</var> is given as the first argument then a vector object is returned that has <code class="func">ConstructingFilter</code> (<a href="chap26_mj.html#X85ABF33684865ED5"><span class="RefLink">26.3-2</span></a>) value <var class="Arg">filt</var>, is defined over the base domain <var class="Arg">R</var>, and has the entries given by the list <var class="Arg">list</var> or the vector object <var class="Arg">v</var>, respectively.</p>

<p>If a semiring <var class="Arg">R</var> is given as the first argument then a vector object is returned whose <code class="func">ConstructingFilter</code> (<a href="chap26_mj.html#X85ABF33684865ED5"><span class="RefLink">26.3-2</span></a>) value is guessed from <var class="Arg">R</var>, again with base domain <var class="Arg">R</var> and entries given by the last argument.</p>

<p>In the remaining cases with two arguments, the first argument is a list or a vector object that defines the entries of the result, and the second argument is a vector object whose <code class="func">ConstructingFilter</code> (<a href="chap26_mj.html#X85ABF33684865ED5"><span class="RefLink">26.3-2</span></a>) and <code class="func">BaseDomain</code> (<a href="chap26_mj.html#X8662026C7CCDB446"><span class="RefLink">26.3-1</span></a>) are taken for the result.</p>

<p>If only a list <var class="Arg">list</var> is given then both the <code class="func">ConstructingFilter</code> (<a href="chap26_mj.html#X85ABF33684865ED5"><span class="RefLink">26.3-2</span></a>) and the <code class="func">BaseDomain</code> (<a href="chap26_mj.html#X8662026C7CCDB446"><span class="RefLink">26.3-1</span></a>) are guessed from this list.</p>

<p>The variant <code class="code">Vector( </code><var class="Arg">v1</var><code class="code">, </code><var class="Arg">v2</var><code class="code"> )</code> is supported also for the case that <var class="Arg">v2</var> is a row vector but not a vector object. In this situation, the result is a row vector that is equal to <var class="Arg">v1</var> and whose internal representation fits to that of <var class="Arg">v2</var>.</p>

<p>If the global option <code class="code">check</code> is set to <code class="keyw">false</code> then <code class="func">Vector</code> need not perform consistency checks.</p>

<p>If the <code class="func">ConstructingFilter</code> (<a href="chap26_mj.html#X85ABF33684865ED5"><span class="RefLink">26.3-2</span></a>) value of the result implies <code class="func">IsCopyable</code> (<a href="chap12_mj.html#X811EFD727EBD1ADC"><span class="RefLink">12.6-1</span></a>) then the result is mutable if and only if the argument that determines the entries of the result (<var class="Arg">list</var>, <var class="Arg">v</var>, <var class="Arg">v1</var>) is mutable.</p>

<p>In the case of a mutable result, it is <em>not</em> guaranteed that the given list of entries is copied.</p>

<p>Default methods for <code class="func">Vector</code> delegate to <code class="func">NewVector</code> (<a href="chap26_mj.html#X860E84397BD148E9"><span class="RefLink">26.4-1</span></a>).</p>

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

<h5>26.4-3 <span class="Heading">ZeroVector</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ZeroVector</code>( <var class="Arg">filt</var>, <var class="Arg">R</var>, <var class="Arg">len</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">‣ ZeroVector</code>( <var class="Arg">R</var>, <var class="Arg">len</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">‣ ZeroVector</code>( <var class="Arg">len</var>, <var class="Arg">v</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">‣ ZeroVector</code>( <var class="Arg">len</var>, <var class="Arg">M</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: a vector object</p>

<p>For a filter <var class="Arg">filt</var>, a semiring <var class="Arg">R</var> and a nonnegative integer <var class="Arg">len</var>, this operation returns a new vector object of length <var class="Arg">len</var> over <var class="Arg">R</var> in the representation <var class="Arg">filt</var> containing only zeros.</p>

<p>If only <var class="Arg">R</var> and <var class="Arg">len</var> are given, then <strong class="pkg">GAP</strong> guesses a suitable representation.</p>

<p>For a vector object <var class="Arg">v</var> and a nonnegative integer <var class="Arg">len</var>, this operation returns a new vector object of length <var class="Arg">len</var> in the same representation as <var class="Arg">v</var> containing only zeros.</p>

<p>For a matrix object <var class="Arg">M</var> and a nonnegative integer <var class="Arg">len</var>, this operation returns a new zero vector object of length <var class="Arg">len</var> in the representation given by the <code class="func">CompatibleVectorFilter</code> (<a href="chap26_mj.html#X818702FD7A2E9D90"><span class="RefLink">26.3-3</span></a>) value of <var class="Arg">M</var>, provided that such a representation exists.</p>

<p>If the <code class="func">ConstructingFilter</code> (<a href="chap26_mj.html#X85ABF33684865ED5"><span class="RefLink">26.3-2</span></a>) value of the result implies <code class="func">IsCopyable</code> (<a href="chap12_mj.html#X811EFD727EBD1ADC"><span class="RefLink">12.6-1</span></a>) then the result is mutable.</p>

<p>Default methods for <code class="func">ZeroVector</code> delegate to <code class="func">NewZeroVector</code> (<a href="chap26_mj.html#X860E84397BD148E9"><span class="RefLink">26.4-1</span></a>).</p>

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

<h5>26.4-4 <span class="Heading">NewMatrix, NewZeroMatrix, NewIdentityMatrix</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NewMatrix</code>( <var class="Arg">filt</var>, <var class="Arg">R</var>, <var class="Arg">ncols</var>, <var class="Arg">list</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">‣ NewZeroMatrix</code>( <var class="Arg">filt</var>, <var class="Arg">R</var>, <var class="Arg">m</var>, <var class="Arg">n</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">‣ NewIdentityMatrix</code>( <var class="Arg">filt</var>, <var class="Arg">R</var>, <var class="Arg">n</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>For a filter <var class="Arg">filt</var>, a semiring <var class="Arg">R</var>, a positive integer <var class="Arg">ncols</var>, and a list <var class="Arg">list</var>, <code class="func">NewMatrix</code> returns a matrix object which has the <code class="func">ConstructingFilter</code> (<a href="chap26_mj.html#X85ABF33684865ED5"><span class="RefLink">26.3-2</span></a>) <var class="Arg">filt</var>, the <code class="func">BaseDomain</code> (<a href="chap26_mj.html#X8662026C7CCDB446"><span class="RefLink">26.3-1</span></a>) <var class="Arg">R</var>, <var class="Arg">n</var> columns (see <code class="func">NumberColumns</code> (<a href="chap26_mj.html#X820ED34380C10E19"><span class="RefLink">26.3-5</span></a>)), and the entries described by <var class="Arg">list</var>, which can be either a plain list of vector objects of length <var class="Arg">ncols</var> or a plain list of plain lists of length <var class="Arg">ncols</var> or a plain list of length a multiple of <var class="Arg">ncols</var> containing the entries in row major order. The list <var class="Arg">list</var> is guaranteed not to be changed by this operation.</p>

<p>The corresponding entries must be in or compatible with <var class="Arg">R</var>. If <var class="Arg">list</var> already contains vector objects, they are copied.</p>

<p>If the global option <code class="code">check</code> is set to <code class="keyw">false</code> then <code class="func">NewMatrix</code> need not perform consistency checks.</p>

<p>Similarly, <code class="func">NewZeroMatrix</code> returns a zero matrix object with <var class="Arg">m</var> rows and <var class="Arg">n</var> columns which has <var class="Arg">filt</var> and <var class="Arg">R</var> as <code class="func">ConstructingFilter</code> (<a href="chap26_mj.html#X85ABF33684865ED5"><span class="RefLink">26.3-2</span></a>) and <code class="func">BaseDomain</code> (<a href="chap26_mj.html#X8662026C7CCDB446"><span class="RefLink">26.3-1</span></a>) values.</p>

<p>Similarly, <code class="func">NewIdentityMatrix</code> returns an identity matrix object with <var class="Arg">n</var> rows and columns which has <var class="Arg">filt</var> and <var class="Arg">R</var> as <code class="func">ConstructingFilter</code> (<a href="chap26_mj.html#X85ABF33684865ED5"><span class="RefLink">26.3-2</span></a>) and <code class="func">BaseDomain</code> (<a href="chap26_mj.html#X8662026C7CCDB446"><span class="RefLink">26.3-1</span></a>) values, and contains the identity element of <var class="Arg">R</var> in the diagonal and the zero of <var class="Arg">R</var> in each off-diagonal position.</p>

<p>The returned object is mutable if and only if <var class="Arg">filt</var> implies <code class="func">IsCopyable</code> (<a href="chap12_mj.html#X811EFD727EBD1ADC"><span class="RefLink">12.6-1</span></a>).</p>

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

<h5>26.4-5 <span class="Heading">Matrix</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Matrix</code>( <var class="Arg">filt</var>, <var class="Arg">R</var>, <var class="Arg">list</var>, <var class="Arg">ncols</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">‣ Matrix</code>( <var class="Arg">filt</var>, <var class="Arg">R</var>, <var class="Arg">list</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">‣ Matrix</code>( <var class="Arg">filt</var>, <var class="Arg">R</var>, <var class="Arg">M</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">‣ Matrix</code>( <var class="Arg">R</var>, <var class="Arg">list</var>, <var class="Arg">ncols</var> )</td><td class="tdright">( operation )</td></tr></table></div>
--> --------------------

--> maximum size reached

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

99%


¤ 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.0.23Bemerkung:  (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.