SSL chap24.html
Sprache: HTML
|
|
| products/sources/formale Sprachen/GAP/doc/ref/chap24.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 24: Matrices</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="chap24" 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="chap23.html">[Previous Chapter]</a> <a href="chap25.html">[Next Chapter]</a> </div>
<p id="mathjaxlink" class="pcenter"><a href="chap24_mj.html">[MathJax on]</a></p>
<p><a id="X812CCAB278643A59" name="X812CCAB278643A59"></a></p>
<div class="ChapSects"><a href="chap24.html#X812CCAB278643A59">24 <span class="Heading">Matrices</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X801E1B5D7EC8DDD3">24.1 <span class="Heading">InfoMatrix (Info Class)</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X78EC82D27B4191DA">24.1-1 InfoMatrix</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X866E55A58164FAED">24.2 <span class="Heading">Categories of Matrices</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7E1AE46B862B185F">24.2-1 IsMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7CF42B8A845BC6A9">24.2-2 IsOrdinaryMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X86EC33E17DD12D0E">24.2-3 IsLieMatrix</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X7899335779A39A95">24.3 <span class="Heading">Operators for Matrices</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X7F5AD28E869B66CB">24.4 <span class="Heading">Properties and Attributes of Matrices</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X83A9DC2085D3A972">24.4-1 DimensionsMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X80AE547B8095A5CB">24.4-2 DefaultFieldOfMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X784EC2777C06AFE4">24.4-3 TraceMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X8488D69A7ADDB4E2">24.4-4 DeterminantMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X824B5DC2875118B3">24.4-5 DeterminantMatrixDestructive</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X80693FAB7D541804">24.4-6 DeterminantMatrixDivFree</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7F8D25897EC1630B">24.4-7 IsEmptyMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X848B80437CE65FF3">24.4-8 IsMonomialMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7EEC8E768178696E">24.4-9 IsDiagonalMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X8740E71C799C0BCC">24.4-10 IsUpperTriangularMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X853A5B988306DBFE">24.4-11 IsLowerTriangularMatrix</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X823FB2398697B957">24.5 <span class="Heading">Matrix Constructions</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7DB902CE848D1524">24.5-1 IdentityMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X86D343A77D9B3D4D">24.5-2 NullMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X8508A7EA812BA0CC">24.5-3 EmptyMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X81042E7A7F247ADE">24.5-4 DiagonalMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X87BADF217C19CBE1">24.5-5 DiagonalMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X806C62A67A7D5379">24.5-6 PermutationMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7C52A38C79C36C35">24.5-7 TransposedMatImmutable</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7DBB40847E2B6252">24.5-8 TransposedMatDestructive</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X8634C79E7DB22934">24.5-9 KroneckerProduct</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X845EC4D18054D140">24.5-10 ReflectionMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7DEBC9967DFDFC18">24.5-11 PrintArray</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X79CC5F568252D341">24.6 <span class="Heading">Random Matrices</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7F957F0280A87961">24.6-1 RandomMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7C939B4A7EDF015D">24.6-2 RandomInvertibleMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X84743732846ACB44">24.6-3 RandomUnimodularMat</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X85485DCE809E323A">24.7 <span class="Heading">Matrices Representing Linear Equations and the Gaussian Algorithm</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7A995A74838950E6">24.7-1 RankMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7BA26C3387AB434E">24.7-2 TriangulizedMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X8384CA8E7B3850D3">24.7-3 TriangulizeMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7DA0D5887DB12DC4">24.7-4 NullspaceMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X87684B0F7AB7B7DB">24.7-5 NullspaceMatDestructive</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X838A519C7CD2969E">24.7-6 SolutionMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7A7880D27CE7C1FE">24.7-7 SolutionMatDestructive</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7AB5AC547809F999">24.7-8 BaseFixedSpace</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X871FCAA97C60B2BA">24.8 <span class="Heading">Eigenvectors and eigenvalues</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7A2462CC7B0C9D66">24.8-1 GeneralisedEigenvalues</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X845CA0457D65876D">24.8-2 GeneralisedEigenspaces</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X8413C6FB7CEE9D59">24.8-3 Eigenvalues</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7A6B047281B52FD7">24.8-4 Eigenspaces</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X8506584579D4EA18">24.8-5 Eigenvectors</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X7E5405D085661B29">24.9 <span class="Heading">Elementary Divisors</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7AC4D74F81908109">24.9-1 ElementaryDivisorsMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7AA1C9047B102204">24.9-2 ElementaryDivisorsTransformationsMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X85819D3F7A582180">24.9-3 DiagonalizeMat</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X7CA6B51D7AE3172B">24.10 <span class="Heading">Echelonized Matrices</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7D5D6BD07B7E981B">24.10-1 SemiEchelonMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X8251F6F57D346385">24.10-2 SemiEchelonMatDestructive</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7EFD1DB5861A54F0">24.10-3 SemiEchelonMatTransformation</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X827D7971800DB661">24.10-4 SemiEchelonMats</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X808F493B839BC7A6">24.10-5 SemiEchelonMatsDestructive</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X86B0D4A886BC0C6E">24.11 <span class="Heading">Matrices as Basis of a Row Space</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7AD6B5F5794D9E46">24.11-1 BaseMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X78B094597E382A5F">24.11-2 BaseMatDestructive</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X78B94EFF87A455BE">24.11-3 BaseOrthogonalSpaceMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7AFF8BCF80C88B45">24.11-4 SumIntersectionMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X8245D54F7AC532EB">24.11-5 BaseSteinitzVectors</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X79D5E53685F0FBEE">24.12 <span class="Heading">Triangular Matrices</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7A9139D686ACB7D8">24.12-1 DiagonalOfMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X84A78C057F9DAE5E">24.12-2 UpperSubdiagonal</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X84D74DEA798A9094">24.12-3 DepthOfUpperTriangularMatrix</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X85B403857F2855F7">24.13 <span class="Heading">Matrices as Linear Mappings</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X87FA0A727CDB060B">24.13-1 CharacteristicPolynomial</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7B52560C792C1A0F">24.13-2 RationalCanonicalFormTransform</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X83F55D4E79BA5D1B">24.13-3 JordanDecomposition</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X85923C107A4569D0">24.13-4 BlownUpMat</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X82AC277D84EC5749">24.13-5 BlownUpVector</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7E06762479A00DF4">24.13-6 CompanionMatrix</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X873822B6830CE367">24.14 <span class="Heading">Matrices over Finite Fields</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7DED2522828B6C30">24.14-1 ImmutableMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X8587A62F818AA0D6">24.14-2 ConvertToMatrixRep</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X84A76F7A7B4166BC">24.14-3 ProjectiveOrder</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X847ADC6779E33A1C">24.14-4 SimultaneousEigenvalues</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X8593A5337D3B2C70">24.15 <span class="Heading">Inverse and Nullspace of an Integer Matrix Modulo an Ideal</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7D8D1E0E83C7F872">24.15-1 InverseMatMod</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7D7DF873826A7C20">24.15-2 BasisNullspaceModN</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X86AE919983B242E2">24.15-3 NullspaceModQ</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X787DF5F07DC7D86E">24.16 <span class="Heading">Special Multiplication Algorithms for Matrices over GF(2)</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7C0C26027FAE0C83">24.16-1 PROD_GF2MAT_GF2MAT_SIMPLE</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X81965B7D7F45E088">24.16-2 PROD_GF2MAT_GF2MAT_ADVANCED</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X7F8A71F38201A250">24.17 <span class="Heading">Block Matrices</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X7D675B3C79CF8871">24.17-1 AsBlockMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X8633538685551E7A">24.17-2 BlockMatrix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X83FAF4158180041F">24.17-3 MatrixByBlockMatrix</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap24.html#X782F2EBF80C431D0">24.18 <span class="Heading">Linear Programming</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap24.html#X845D5F8D7D905CB8">24.18-1 SimplexMethod</a></span>
</div></div>
</div>
<h3>24 <span class="Heading">Matrices</span></h3>
<p>In <strong class="pkg">GAP</strong>, Matrices can be represented by lists of row vectors, see <a href="chap23.html#X82C7E6CF7BA03391"><span class="RefLink">23</span></a>. (For a more general way to represent vectors and matrices, see Chapter <a href="chap26.html#X856C23B87E50F118"><span class="RefLink">26</span></a>). The row vectors must all have the same length, and their elements must lie in a common ring. However, since checking rectangularness can be expensive functions and methods of operations for matrices often will not give an error message for non-rectangular lists of lists –in such cases the result is undefined.</p>
<p>Because matrices are just a special case of lists, all operations and functions for lists are applicable to matrices also (see chapter <a href="chap21.html#X7B256AE5780F140A"><span class="RefLink">21</span></a>). This especially includes accessing elements of a matrix (see <a href="chap21.html#X7921047F83F5FA28"><span class="RefLink">21.3</span></a>), changing elements of a matrix (see <a href="chap21.html#X8611EF768210625B"><span class="RefLink">21.4</span></a>), and comparing matrices (see <a href="chap21.html#X8016D50F85147A77"><span class="RefLink">21.10</span></a>).</p>
<p>Note that, since a matrix is a list of lists, the behaviour of <code class="func">ShallowCopy</code> (<a href="chap12.html#X846BC7107C352031"><span class="RefLink">12.7-1</span></a>) for matrices is just a special case of <code class="func">ShallowCopy</code> (<a href="chap12.html#X846BC7107C352031"><span class="RefLink">12.7-1</span></a>) for lists (see <a href="chap21.html#X7ED7C0738495556F"><span class="RefLink">21.7</span></a>); called with an immutable matrix <var class="Arg">mat</var>, <code class="func">ShallowCopy</code> (<a href="chap12.html#X846BC7107C352031"><span class="RefLink">12.7-1</span></a>) returns a mutable matrix whose rows are identical to the rows of <var class="Arg">mat</var>. In particular the rows are still immutable. To get a matrix whose rows are mutable, one can use <code class="code">List( <var class="Arg">mat</var>, ShallowCopy )</code>.</p>
<p><a id="X801E1B5D7EC8DDD3" name="X801E1B5D7EC8DDD3"></a></p>
<h4>24.1 <span class="Heading">InfoMatrix (Info Class)</span></h4>
<p><a id="X78EC82D27B4191DA" name="X78EC82D27B4191DA"></a></p>
<h5>24.1-1 InfoMatrix</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ InfoMatrix</code></td><td class="tdright">( info class )</td></tr></table></div>
<p>The info class for matrix operations is <code class="func">InfoMatrix</code>.</p>
<p><a id="X866E55A58164FAED" name="X866E55A58164FAED"></a></p>
<h4>24.2 <span class="Heading">Categories of Matrices</span></h4>
<p><a id="X7E1AE46B862B185F" name="X7E1AE46B862B185F"></a></p>
<h5>24.2-1 IsMatrix</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsMatrix</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>By convention <em>matrix</em> is a list of lists of equal length whose entries lie in a common ring.</p>
<p>For technical reasons laid out at the top of Chapter <a href="chap24.html#X812CCAB278643A59"><span class="RefLink">24</span></a>, the filter <code class="func">IsMatrix</code> is a synonym for a table of ring elements, (see <code class="func">IsTable</code> (<a href="chap21.html#X80872FAF80EB5DF9"><span class="RefLink">21.1-4</span></a>) and <code class="func">IsRingElement</code> (<a href="chap31.html#X84BF40CA86C07361"><span class="RefLink">31.14-16</span></a>)). This means that <code class="func">IsMatrix</code> returns <code class="keyw">true</code> for tables such as <code class="code">[[1,2],[3]]</code>. If necessary, <code class="func">IsRectangularTable</code> (<a href="chap21.html#X79581E0387F7F7A9"><span class="RefLink">21.1-5</span></a>) can be used to test whether an object is a list of homogeneous lists of equal lengths manually.</p>
<p>Note that matrices may have different multiplications, besides the usual matrix product there is for example the Lie product. So there are categories such as <code class="func">IsOrdinaryMatrix</code> (<a href="chap24.html#X7CF42B8A845BC6A9"><span class="RefLink">24.2-2</span></a>) and <code class="func">IsLieMatrix</code> (<a href="chap24.html#X86EC33E17DD12D0E"><span class="RefLink">24.2-3</span></a>) that describe the matrix multiplication. One can form the product of two matrices only if they support the same multiplication.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">mat:=[[1,2,3],[4,5,6],[7,8,9]];</span>
[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">IsMatrix(mat);</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">mat:=[[1,2],[3]];</span>
[ [ 1, 2 ], [ 3 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">IsMatrix(mat);</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">IsRectangularTable(mat);</span>
false
</pre></div>
<p>Note that the empty list <code class="code">[]</code> and more complex <q>empty</q> structures such as <code class="code">[[]]</code> are <em>not</em> matrices, although special methods allow them be used in place of matrices in some situations. See <code class="func">EmptyMatrix</code> (<a href="chap24.html#X8508A7EA812BA0CC"><span class="RefLink">24.5-3</span></a>) below.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">[[0]]*[[]];</span>
[ [ ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">IsMatrix([[]]);</span>
false
</pre></div>
<p><a id="X7CF42B8A845BC6A9" name="X7CF42B8A845BC6A9"></a></p>
<h5>24.2-2 IsOrdinaryMatrix</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsOrdinaryMatrix</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>An <em>ordinary matrix</em> is a matrix whose multiplication is the ordinary matrix multiplication.</p>
<p>Each matrix in internal representation is in the category <code class="func">IsOrdinaryMatrix</code>, and arithmetic operations with objects in <code class="func">IsOrdinaryMatrix</code> produce again matrices in <code class="func">IsOrdinaryMatrix</code>.</p>
<p>Note that we want that Lie matrices shall be matrices that behave in the same way as ordinary matrices, except that they have a different multiplication. So we must distinguish the different matrix multiplications, in order to be able to describe the applicability of multiplication, and also in order to form a matrix of the appropriate type as the sum, difference etc. of two matrices which have the same multiplication.</p>
<p><a id="X86EC33E17DD12D0E" name="X86EC33E17DD12D0E"></a></p>
<h5>24.2-3 IsLieMatrix</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsLieMatrix</code>( <var class="Arg">mat</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>A <em>Lie matrix</em> is a matrix whose multiplication is given by the Lie bracket. (Note that a matrix with ordinary matrix multiplication is in the category <code class="func">IsOrdinaryMatrix</code> (<a href="chap24.html#X7CF42B8A845BC6A9"><span class="RefLink">24.2-2</span></a>).)</p>
<p>Each matrix created by <code class="func">LieObject</code> (<a href="chap64.html#X87F121978775AF48"><span class="RefLink">64.1-1</span></a>) is in the category <code class="func">IsLieMatrix</code>, and arithmetic operations with objects in <code class="func">IsLieMatrix</code> produce again matrices in <code class="func">IsLieMatrix</code>.</p>
<p><a id="X7899335779A39A95" name="X7899335779A39A95"></a></p>
<h4>24.3 <span class="Heading">Operators for Matrices</span></h4>
<p>The rules for arithmetic operations involving matrices are in fact special cases of those for the arithmetic of lists, given in Section <a href="chap21.html#X845EEAF083D43CCE"><span class="RefLink">21.11</span></a> and the following sections, here we reiterate that definition, in the language of vectors and matrices.</p>
<p>Note that the additive behaviour sketched below is defined only for lists in the category <code class="func">IsGeneralizedRowVector</code> (<a href="chap21.html#X87ABCEE9809585A0"><span class="RefLink">21.12-1</span></a>), and the multiplicative behaviour is defined only for lists in the category <code class="func">IsMultiplicativeGeneralizedRowVector</code> (<a href="chap21.html#X7FBCA5B58308C158"><span class="RefLink">21.12-2</span></a>) (see <a href="chap21.html#X84D642967B8546B7"><span class="RefLink">21.12</span></a>).</p>
<p><code class="code"><var class="Arg">mat1</var> + <var class="Arg">mat2</var></code></p>
<p>returns the sum of the two matrices <var class="Arg">mat1</var> and <var class="Arg">mat2</var>, Probably the most usual situation is that <var class="Arg">mat1</var> and <var class="Arg">mat2</var> have the same dimensions and are defined over a common field; in this case the sum is a new matrix over the same field where each entry is the sum of the corresponding entries of the matrices.</p>
<p>In more general situations, the sum of two matrices need not be a matrix, for example adding an integer matrix <var class="Arg">mat1</var> and a matrix <var class="Arg">mat2</var> over a finite field yields the table of pointwise sums, which will be a mixture of finite field elements and integers if <var class="Arg">mat1</var> has bigger dimensions than <var class="Arg">mat2</var>.</p>
<p><code class="code"><var class="Arg">scalar</var> + <var class="Arg">mat</var></code></p>
<p><code class="code"><var class="Arg">mat</var> + <var class="Arg">scalar</var></code></p>
<p>returns the sum of the scalar <var class="Arg">scalar</var> and the matrix <var class="Arg">mat</var>. Probably the most usual situation is that the entries of <var class="Arg">mat</var> lie in a common field with <var class="Arg">scalar</var>; in this case the sum is a new matrix over the same field where each entry is the sum of the scalar and the corresponding entry of the matrix.</p>
<p>More general situations are for example the sum of an integer scalar and a matrix over a finite field, or the sum of a finite field element and an integer matrix.</p>
<p><code class="code"><var class="Arg">mat1</var> - <var class="Arg">mat2</var></code></p>
<p><code class="code"><var class="Arg">scalar</var> - <var class="Arg">mat</var></code></p>
<p><code class="code"><var class="Arg">mat</var> - <var class="Arg">scalar</var></code></p>
<p>Subtracting a matrix or scalar is defined as adding its additive inverse, so the statements for the addition hold likewise.</p>
<p><code class="code"><var class="Arg">scalar</var> * <var class="Arg">mat</var></code></p>
<p><code class="code"><var class="Arg">mat</var> * <var class="Arg">scalar</var></code></p>
<p>returns the product of the scalar <var class="Arg">scalar</var> and the matrix <var class="Arg">mat</var>. Probably the most usual situation is that the elements of <var class="Arg">mat</var> lie in a common field with <var class="Arg">scalar</var>; in this case the product is a new matrix over the same field where each entry is the product of the scalar and the corresponding entry of the matrix.</p>
<p>More general situations are for example the product of an integer scalar and a matrix over a finite field, or the product of a finite field element and an integer matrix.</p>
<p><code class="code"><var class="Arg">vec</var> * <var class="Arg">mat</var></code></p>
<p>returns the product of the row vector <var class="Arg">vec</var> and the matrix <var class="Arg">mat</var>. Probably the most usual situation is that <var class="Arg">vec</var> and <var class="Arg">mat</var> have the same lengths and are defined over a common field, and that all rows of <var class="Arg">mat</var> have some common length <span class="SimpleMath">m</span>; in this case the product is a new row vector of length <span class="SimpleMath">m</span> over the same field which is the sum of the scalar multiples of the rows of <var class="Arg">mat</var> with the corresponding entries of <var class="Arg">vec</var>.</p>
<p>More general situations are for example the product of an integer vector and a matrix over a finite field, or the product of a vector over a finite field and an integer matrix.</p>
<p><code class="code"><var class="Arg">mat</var> * <var class="Arg">vec</var></code></p>
<p>returns the product of the matrix <var class="Arg">mat</var> and the row vector <var class="Arg">vec</var>. (This is the standard product of a matrix with a <em>column</em> vector.) Probably the most usual situation is that the length of <var class="Arg">vec</var> and of all rows of <var class="Arg">mat</var> are equal, and that the elements of <var class="Arg">mat</var> and <var class="Arg">vec</var> lie in a common field; in this case the product is a new row vector of the same length as <var class="Arg">mat</var> and over the same field which is the sum of the scalar multiples of the columns of <var class="Arg">mat</var> with the corresponding entries of <var class="Arg">vec</var>.</p>
<p>More general situations are for example the product of an integer matrix and a vector over a finite field, or the product of a matrix over a finite field and an integer vector.</p>
<p><code class="code"><var class="Arg">mat1</var> * <var class="Arg">mat2</var></code></p>
<p>This form evaluates to the (Cauchy) product of the two matrices <var class="Arg">mat1</var> and <var class="Arg">mat2</var>. Probably the most usual situation is that the number of columns of <var class="Arg">mat1</var> equals the number of rows of <var class="Arg">mat2</var>, and that the elements of <var class="Arg">mat</var> and <var class="Arg">vec</var> lie in a common field; if <var class="Arg">mat1</var> is a matrix with <span class="SimpleMath">m</span> rows and <span class="SimpleMath">n</span> columns and <var class="Arg">mat2</var> is a matrix with <span class="SimpleMath">n</span> rows and <span class="SimpleMath">o</span> columns, the result is a new matrix with <span class="SimpleMath">m</span> rows and <span class="SimpleMath">o</span> columns. The element in row <span class="SimpleMath">i</span> at position <span class="SimpleMath">j</span> of the product is the sum of <span class="SimpleMath"><var class="Arg">mat1</var>[i][l] * <var class="Arg">mat2</var>[l][j]</span>, with <span class="SimpleMath">l</span> running from <span class="SimpleMath">1</span> to <span class="SimpleMath">n</span>.</p>
<p><code class="code">Inverse( <var class="Arg">mat</var> )</code></p>
<p>returns the inverse of the matrix <var class="Arg">mat</var>, which must be an invertible square matrix. If <var class="Arg">mat</var> is not invertible then <code class="keyw">fail</code> is returned.</p>
<p><code class="code"><var class="Arg">mat1</var> / <var class="Arg">mat2</var></code></p>
<p><code class="code"><var class="Arg">scalar</var> / <var class="Arg">mat</var></code></p>
<p><code class="code"><var class="Arg">mat</var> / <var class="Arg">scalar</var></code></p>
<p><code class="code"><var class="Arg">vec</var> / <var class="Arg">mat</var></code></p>
<p>In general, <code class="code"><var class="Arg">left</var> / <var class="Arg">right</var></code> is defined as <code class="code"><var class="Arg">left</var> * <var class="Arg">right</var>^-1</code>. Thus in the above forms the right operand must always be invertible.</p>
<p><code class="code"><var class="Arg">mat</var> ^ <var class="Arg">int</var></code></p>
<p><code class="code"><var class="Arg">mat1</var> ^ <var class="Arg">mat2</var></code></p>
<p><code class="code"><var class="Arg">vec</var> ^ <var class="Arg">mat</var></code></p>
<p>Powering a square matrix <var class="Arg">mat</var> by an integer <var class="Arg">int</var> yields the <var class="Arg">int</var>-th power of <var class="Arg">mat</var>; if <var class="Arg">int</var> is negative then <var class="Arg">mat</var> must be invertible, if <var class="Arg">int</var> is <code class="code">0</code> then the result is the identity matrix <code class="code">One( <var class="Arg">mat</var> )</code>, even if <var class="Arg">mat</var> is not invertible.</p>
<p>Powering a square matrix <var class="Arg">mat1</var> by an invertible square matrix <var class="Arg">mat2</var> of the same dimensions yields the conjugate of <var class="Arg">mat1</var> by <var class="Arg">mat2</var>, i.e., the matrix <code class="code"><var class="Arg">mat2</var>^-1 * <var class="Arg">mat1</var> * <var class="Arg">mat2</var></code>.</p>
<p>Powering a row vector <var class="Arg">vec</var> by a matrix <var class="Arg">mat</var> is in every respect equivalent to <code class="code"><var class="Arg">vec</var> * <var class="Arg">mat</var></code>. This operations reflects the fact that matrices act naturally on row vectors by multiplication from the right, and that the powering operator is <strong class="pkg">GAP</strong>'s standard for group actions.
<p><code class="code">Comm( <var class="Arg">mat1</var>, <var class="Arg">mat2</var> )</code></p>
<p>returns the commutator of the square invertible matrices <var class="Arg">mat1</var> and <var class="Arg">mat2</var> of the same dimensions and over a common field, which is the matrix <code class="code"><var class="Arg">mat1</var>^-1 * <var class="Arg">mat2</var>^-1 * <var class="Arg">mat1</var> * <var class="Arg">mat2</var></code>.</p>
<p>The following cases are still special cases of the general list arithmetic defined in <a href="chap21.html#X845EEAF083D43CCE"><span class="RefLink">21.11</span></a>.</p>
<p><code class="code"><var class="Arg">scalar</var> + <var class="Arg">matlist</var></code></p>
<p><code class="code"><var class="Arg">matlist</var> + <var class="Arg">scalar</var></code></p>
<p><code class="code"><var class="Arg">scalar</var> - <var class="Arg">matlist</var></code></p>
<p><code class="code"><var class="Arg">matlist</var> - <var class="Arg">scalar</var></code></p>
<p><code class="code"><var class="Arg">scalar</var> * <var class="Arg">matlist</var></code></p>
<p><code class="code"><var class="Arg">matlist</var> * <var class="Arg">scalar</var></code></p>
<p><code class="code"><var class="Arg">matlist</var> / <var class="Arg">scalar</var></code></p>
<p>A scalar <var class="Arg">scalar</var> may also be added, subtracted, multiplied with, or divided into a list <var class="Arg">matlist</var> of matrices. The result is a new list of matrices where each matrix is the result of performing the operation with the corresponding matrix in <var class="Arg">matlist</var>.</p>
<p><code class="code"><var class="Arg">mat</var> * <var class="Arg">matlist</var></code></p>
<p><code class="code"><var class="Arg">matlist</var> * <var class="Arg">mat</var></code></p>
<p>A matrix <var class="Arg">mat</var> may also be multiplied with a list <var class="Arg">matlist</var> of matrices. The result is a new list of matrices, where each entry is the product of <var class="Arg">mat</var> and the corresponding entry in <var class="Arg">matlist</var>.</p>
<p><code class="code"><var class="Arg">matlist</var> / <var class="Arg">mat</var></code></p>
<p>Dividing a list <var class="Arg">matlist</var> of matrices by an invertible matrix <var class="Arg">mat</var> evaluates to <code class="code"><var class="Arg">matlist</var> * <var class="Arg">mat</var>^-1</code>.</p>
<p><code class="code"><var class="Arg">vec</var> * <var class="Arg">matlist</var></code></p>
<p>returns the product of the vector <var class="Arg">vec</var> and the list of matrices <var class="Arg">mat</var>. The lengths <var class="Arg">l</var> of <var class="Arg">vec</var> and <var class="Arg">matlist</var> must be equal. All matrices in <var class="Arg">matlist</var> must have the same dimensions. The elements of <var class="Arg">vec</var> and the elements of the matrices in <var class="Arg">matlist</var> must lie in a common ring. The product is the sum over <code class="code"><var class="Arg">vec</var>[<var class="Arg">i</var>] * <var class="Arg">matlist</var>[<var class="Arg">i</var>]</code> with <var class="Arg">i</var> running from 1 to <var class="Arg">l</var>.</p>
<p>For the mutability of results of arithmetic operations, see <a href="chap12.html#X7F0C119682196D65"><span class="RefLink">12.6</span></a>.</p>
<p><a id="X7F5AD28E869B66CB" name="X7F5AD28E869B66CB"></a></p>
<h4>24.4 <span class="Heading">Properties and Attributes of Matrices</span></h4>
<p><a id="X83A9DC2085D3A972" name="X83A9DC2085D3A972"></a></p>
<h5>24.4-1 DimensionsMat</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DimensionsMat</code>( <var class="Arg">mat</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>is a list of length 2, the first being the number of rows, the second being the number of columns of the matrix <var class="Arg">mat</var>. If <var class="Arg">mat</var> is malformed, that is, it is not a <code class="func">IsRectangularTable</code> (<a href="chap21.html#X79581E0387F7F7A9"><span class="RefLink">21.1-5</span></a>), returns <code class="keyw">fail</code>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">DimensionsMat([[1,2,3],[4,5,6]]);</span>
[ 2, 3 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">DimensionsMat([[1,2,3],[4,5]]);</span>
fail
</pre></div>
<p><a id="X80AE547B8095A5CB" name="X80AE547B8095A5CB"></a></p>
<h5>24.4-2 DefaultFieldOfMatrix</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DefaultFieldOfMatrix</code>( <var class="Arg">mat</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>For a matrix <var class="Arg">mat</var>, <code class="func">DefaultFieldOfMatrix</code> returns either a field (not necessarily the smallest one) containing all entries of <var class="Arg">mat</var>, or <code class="keyw">fail</code>.</p>
<p>If <var class="Arg">mat</var> is a matrix of finite field elements or a matrix of cyclotomics, <code class="func">DefaultFieldOfMatrix</code> returns the default field generated by the matrix entries (see <a href="chap59.html#X81B54A8378734C33"><span class="RefLink">59.3</span></a> and <a href="chap18.html#X79E25C3085AA568F"><span class="RefLink">18.1</span></a>).</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">DefaultFieldOfMatrix([[Z(4),Z(8)]]);</span>
GF(2^6)
</pre></div>
<p><a id="X784EC2777C06AFE4" name="X784EC2777C06AFE4"></a></p>
<h5>24.4-3 TraceMatrix</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ TraceMatrix</code>( <var class="Arg">mat</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">‣ TraceMat</code>( <var class="Arg">mat</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">‣ Trace</code>( <var class="Arg">mat</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>The trace of a square matrix is the sum of its diagonal entries.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">TraceMatrix([[1,2,3],[4,5,6],[7,8,9]]);</span>
15
</pre></div>
<p><a id="X8488D69A7ADDB4E2" name="X8488D69A7ADDB4E2"></a></p>
<h5>24.4-4 DeterminantMatrix</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DeterminantMatrix</code>( <var class="Arg">mat</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">‣ DeterminantMat</code>( <var class="Arg">mat</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">‣ Determinant</code>( <var class="Arg">mat</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>returns the determinant of the square matrix <var class="Arg">mat</var>.</p>
<p>These methods assume implicitly that <var class="Arg">mat</var> is defined over an integral domain whose quotient field is implemented in <strong class="pkg">GAP</strong>. For matrices defined over an arbitrary commutative ring with one see <code class="func">DeterminantMatDivFree</code> (<a href="chap24.html#X80693FAB7D541804"><span class="RefLink">24.4-6</span></a>).</p>
<p><a id="X824B5DC2875118B3" name="X824B5DC2875118B3"></a></p>
<h5>24.4-5 DeterminantMatrixDestructive</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DeterminantMatrixDestructive</code>( <var class="Arg">mat</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">‣ DeterminantMatDestructive</code>( <var class="Arg">mat</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Does the same as <code class="func">DeterminantMatrix</code> (<a href="chap24.html#X8488D69A7ADDB4E2"><span class="RefLink">24.4-4</span></a>), with the difference that it may destroy its argument. The matrix <var class="Arg">mat</var> must be mutable.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">DeterminantMatrix([[1,2],[2,1]]);</span>
-3
<span class="GAPprompt">gap></span> <span class="GAPinput">mm:= [[1,2],[2,1]];;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">DeterminantMatrixDestructive( mm );</span>
-3
<span class="GAPprompt">gap></span> <span class="GAPinput">mm;</span>
[ [ 1, 2 ], [ 0, -3 ] ]
</pre></div>
<p><a id="X80693FAB7D541804" name="X80693FAB7D541804"></a></p>
<h5>24.4-6 DeterminantMatrixDivFree</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DeterminantMatrixDivFree</code>( <var class="Arg">mat</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">‣ DeterminantMatDivFree</code>( <var class="Arg">mat</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>return the determinant of a square matrix <var class="Arg">mat</var> over an arbitrary commutative ring with one using the division free method of Mahajan and Vinay <a href="chapBib.html#biBMV97">[MV97]</a>.</p>
<p><a id="X7F8D25897EC1630B" name="X7F8D25897EC1630B"></a></p>
<h5>24.4-7 IsEmptyMatrix</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsEmptyMatrix</code>( <var class="Arg">M</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>Returns: A boolean</p>
<p>Is <code class="keyw">true</code> if the matrix object <var class="Arg">M</var> either has zero columns or zero rows, and <code class="keyw">false</code> otherwise. In other words, a matrix object is empty if it has no entries.</p>
<p><a id="X848B80437CE65FF3" name="X848B80437CE65FF3"></a></p>
<h5>24.4-8 IsMonomialMatrix</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsMonomialMatrix</code>( <var class="Arg">mat</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>A matrix is monomial if and only if it has exactly one nonzero entry in every row and every column.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsMonomialMatrix([[0,1],[1,0]]);</span>
true
</pre></div>
<p><a id="X7EEC8E768178696E" name="X7EEC8E768178696E"></a></p>
<h5>24.4-9 IsDiagonalMatrix</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsDiagonalMatrix</code>( <var class="Arg">mat</var> )</td><td class="tdright">( property )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsDiagonalMat</code>( <var class="Arg">mat</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>return <code class="keyw">true</code> if the matrix <var class="Arg">mat</var> has only zero entries off the main diagonal, and <code class="keyw">false</code> otherwise.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsDiagonalMatrix( [ [ 1 ] ] );</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">IsDiagonalMatrix( [ [ 1, 0, 0 ], [ 0, 1, 0 ] ] );</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">IsDiagonalMatrix( [ [ 0, 1 ], [ 1, 0 ] ] );</span>
false
</pre></div>
<p><a id="X8740E71C799C0BCC" name="X8740E71C799C0BCC"></a></p>
<h5>24.4-10 IsUpperTriangularMatrix</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsUpperTriangularMatrix</code>( <var class="Arg">mat</var> )</td><td class="tdright">( property )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsUpperTriangularMat</code>( <var class="Arg">mat</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>return <code class="keyw">true</code> if the matrix <var class="Arg">mat</var> has only zero entries below the main diagonal, and <code class="keyw">false</code> otherwise.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsUpperTriangularMatrix( [ [ 1 ] ] );</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">IsUpperTriangularMatrix( [ [ 1, 2, 3 ], [ 0, 5, 6 ] ] );</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">IsUpperTriangularMatrix( [ [ 0, 1 ], [ 1, 0 ] ] );</span>
false
</pre></div>
<p><a id="X853A5B988306DBFE" name="X853A5B988306DBFE"></a></p>
<h5>24.4-11 IsLowerTriangularMatrix</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsLowerTriangularMatrix</code>( <var class="Arg">mat</var> )</td><td class="tdright">( property )</t | |