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
|
<!-- ------------------------------------------------------------------- -->
<!-- -->
<!-- matrix.xml Utils documentation -->
<!-- -->
<!-- Copyright (C) 2023, The GAP Group -->
<!-- -->
<!-- ------------------------------------------------------------------- -->
<?xml version="1.0" encoding="UTF-8"?>
<Chapter Label="chap-matrix">
<Heading>Matrices</Heading>
<Section Label="sec-matrix-ops">
<Heading>Some operations for matrices</Heading>
<ManSection>
<Oper Name="DirectSumDecompositionMatrices"
Arg="M" />
<Description>
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
<Package>Utils</Package>.
What is provided here is a revised version of the original solution,
returning a list of decompositions.
<P/>
This function is a partial inverse to the undocumented library operation
<C>DirectSumMat</C>.
So if <M>L</M> is the list of diagonal decompositions of a matrix <M>M</M>
then each entry in <M>L</M> is a list of matrices, and the direct sum of
each of these lists is equal to the original <M>M</M>.
<P/>
In the following examples, <M>M_6</M> is an obvious direct sum
with <M>3</M> blocks.
<M>M_4</M> is an example with three decompositions,
while <M>M_8 = M_4 \oplus M_4</M> has <M>16</M> decompositions (not listed).
<P/>
</Description>
</ManSection>
<Example>
<![CDATA[
gap> M6 := [ [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] ];;
gap> Display( M6 );
[ [ 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 ] ]
gap> L6 := DirectSumDecompositionMatrices( M6 );
[ [ [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ], [ [ 9 ] ], [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
] ]
gap> M4 := [ [0,3,0,0], [0,0,0,0], [0,0,0,0], [0,0,4,0] ];;
gap> Display( M4 );
[ [ 0, 3, 0, 0 ],
[ 0, 0, 0, 0 ],
[ 0, 0, 0, 0 ],
[ 0, 0, 4, 0 ] ]
gap> L4 := DirectSumDecompositionMatrices( M4 );
[ [ [ [ 0, 3 ] ], [ [ 0, 0 ], [ 0, 0 ], [ 4, 0 ] ] ],
[ [ [ 0, 3 ], [ 0, 0 ] ], [ [ 0, 0 ], [ 4, 0 ] ] ],
[ [ [ 0, 3 ], [ 0, 0 ], [ 0, 0 ] ], [ [ 4, 0 ] ] ] ]
gap> for L in L4 do
> A := DirectSumMat( L );;
> if ( A = M4 ) then Print( "yes, A = M4\n" ); fi;
> od;
yes, A = M4
yes, A = M4
yes, A = M4
gap> M8 := DirectSumMat( M4, M4 );;
gap> Display( M8 );
[ [ 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 ] ]
gap> L8 := DirectSumDecompositionMatrices( M8 );;
gap> Length( L8 );
16
]]>
</Example>
<P/>
The current method does not, however, catch all possible decompositions.
In the following example the matrix <M>M_5</M> has its third row
and third column extirely zero, and the only decomposition found
has a <M>[0]</M> factor.
There are clearly two <M>2</M>-factor decompositions with a
<M>2</M>-by-<M>3</M> and a <M>3</M>-by-<M>2</M> factor,
but these are not found at present.
<P/>
<Example>
<![CDATA[
gap> M5 := [ [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] ];;
gap> Display(M5);
[ [ 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 ] ]
gap> L5 := DirectSumDecompositionMatrices( M5 );
[ [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 0 ] ], [ [ 6, 7 ], [ 8, 9 ] ] ] ]
]]>
</Example>
</Section>
</Chapter>
|