1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
<?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 (Utils) - Chapter 6: 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="chap6" 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="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="chap5.html">[Previous Chapter]</a> <a href="chap7.html">[Next Chapter]</a> </div>
<p id="mathjaxlink" class="pcenter"><a href="chap6_mj.html">[MathJax on]</a></p>
<p><a id="X812CCAB278643A59" name="X812CCAB278643A59"></a></p>
<div class="ChapSects"><a href="chap6.html#X812CCAB278643A59">6 <span class="Heading">Matrices</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap6.html#X802118FB7C94D6BA">6.1 <span class="Heading">Some operations for matrices</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap6.html#X787B89237E1398B6">6.1-1 DirectSumDecompositionMatrices</a></span>
</div></div>
</div>
<h3>6 <span class="Heading">Matrices</span></h3>
<p><a id="X802118FB7C94D6BA" name="X802118FB7C94D6BA"></a></p>
<h4>6.1 <span class="Heading">Some operations for matrices</span></h4>
<p><a id="X787B89237E1398B6" name="X787B89237E1398B6"></a></p>
<h5>6.1-1 DirectSumDecompositionMatrices</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DirectSumDecompositionMatrices</code>( <var class="Arg">M</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>In June 2023 Hongyi Zhao asked in the Forum for a function to implement matrix decomposition into blocks. Such a function was then provided by Pedro García-Sánchez. Hongyi Zhao then requested that the function be added to <strong class="pkg">Utils</strong>. What is provided here is a revised version of the original solution, returning a list of decompositions.</p>
<p>This function is a partial inverse to the undocumented library operation <code class="code">DirectSumMat</code>. So if <span class="SimpleMath">L</span> is the list of diagonal decompositions of a matrix <span class="SimpleMath">M</span> then each entry in <span class="SimpleMath">L</span> is a list of matrices, and the direct sum of each of these lists is equal to the original <span class="SimpleMath">M</span>.</p>
<p>In the following examples, <span class="SimpleMath">M_6</span> is an obvious direct sum with <span class="SimpleMath">3</span> blocks. <span class="SimpleMath">M_4</span> is an example with three decompositions, while <span class="SimpleMath">M_8 = M_4 ⊕ M_4</span> has <span class="SimpleMath">16</span> decompositions (not listed).</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">M6 := [ [1,2,0,0,0,0], [3,4,0,0,0,0], [5,6,0,0,0,0], </span>
<span class="GAPprompt">></span> <span class="GAPinput"> [0,0,9,0,0,0], [0,0,0,1,2,3], [0,0,0,4,5,6] ];;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">Display( M6 );</span>
[ [ 1, 2, 0, 0, 0, 0 ],
[ 3, 4, 0, 0, 0, 0 ],
[ 5, 6, 0, 0, 0, 0 ],
[ 0, 0, 9, 0, 0, 0 ],
[ 0, 0, 0, 1, 2, 3 ],
[ 0, 0, 0, 4, 5, 6 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">L6 := DirectSumDecompositionMatrices( M6 );</span>
[ [ [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ], [ [ 9 ] ], [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">M4 := [ [0,3,0,0], [0,0,0,0], [0,0,0,0], [0,0,4,0] ];;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">Display( M4 );</span>
[ [ 0, 3, 0, 0 ],
[ 0, 0, 0, 0 ],
[ 0, 0, 0, 0 ],
[ 0, 0, 4, 0 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">L4 := DirectSumDecompositionMatrices( M4 );</span>
[ [ [ [ 0, 3 ] ], [ [ 0, 0 ], [ 0, 0 ], [ 4, 0 ] ] ],
[ [ [ 0, 3 ], [ 0, 0 ] ], [ [ 0, 0 ], [ 4, 0 ] ] ],
[ [ [ 0, 3 ], [ 0, 0 ], [ 0, 0 ] ], [ [ 4, 0 ] ] ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">for L in L4 do </span>
<span class="GAPprompt">></span> <span class="GAPinput"> A := DirectSumMat( L );; </span>
<span class="GAPprompt">></span> <span class="GAPinput"> if ( A = M4 ) then Print( "yes, A = M4\n" ); fi; </span>
<span class="GAPprompt">></span> <span class="GAPinput"> od;</span>
yes, A = M4
yes, A = M4
yes, A = M4
<span class="GAPprompt">gap></span> <span class="GAPinput">M8 := DirectSumMat( M4, M4 );; </span>
<span class="GAPprompt">gap></span> <span class="GAPinput">Display( M8 );</span>
[ [ 0, 3, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 4, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 3, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 4, 0 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">L8 := DirectSumDecompositionMatrices( M8 );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">Length( L8 ); </span>
16
</pre></div>
<p>The current method does not, however, catch all possible decompositions. In the following example the matrix <span class="SimpleMath">M_5</span> has its third row and third column extirely zero, and the only decomposition found has a <span class="SimpleMath">[0]</span> factor. There are clearly two <span class="SimpleMath">2</span>-factor decompositions with a <span class="SimpleMath">2</span>-by-<span class="SimpleMath">3</span> and a <span class="SimpleMath">3</span>-by-<span class="SimpleMath">2</span> factor, but these are not found at present.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">M5 := [ [1,2,0,0,0], [3,4,0,0,0], [0,0,0,0,0],</span>
<span class="GAPprompt">></span> <span class="GAPinput"> [0,0,0,6,7], [0,0,0,8,9] ];;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">Display(M5);</span>
[ [ 1, 2, 0, 0, 0 ],
[ 3, 4, 0, 0, 0 ],
[ 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 6, 7 ],
[ 0, 0, 0, 8, 9 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">L5 := DirectSumDecompositionMatrices( M5 ); </span>
[ [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 0 ] ], [ [ 6, 7 ], [ 8, 9 ] ] ] ]
</pre></div>
<div class="chlinkprevnextbot"> <a href="chap0.html">[Top of Book]</a> <a href="chap0.html#contents">[Contents]</a> <a href="chap5.html">[Previous Chapter]</a> <a href="chap7.html">[Next Chapter]</a> </div>
<div class="chlinkbot"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a> <a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="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="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
<hr />
<p class="foot">generated by <a href="https://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
</body>
</html>
|