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 , 1 , 0 , 0 , 0 , 0 , 0
},
{
{
1 , 5 , 3 , 2 , 1 , 2 , 5 , 2 , 10 , 3 , 0 , 4 , 5 , 5 , 0 , 1 , 6 , 0 , 5 , 1 , 0 , 0 , 0 , 0 , 0
1 , 5 , 3 , 2 , 1 , 2 , 5 , 2 , 10 , 3 , 0 , 4 , 5 , 5 , 0 , 1 , 6 , 0 , 5 , 1 , 0 , 0 , 0 , 0 , 0
}
}
,
,
{
{
{
1 , 1 , 1 , 2 , 0 , 0 , 5 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 0 , 2 , 5 , 5 , 0 , 0 , 10 , 0 , 0 , 0 , 2
1 , 1 , 1 , 2 , 0 , 0 , 5 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 0 , 2 , 5 , 5 , 0 , 0 , 10 , 0 , 0 , 0 , 2
1 , 1 , 1 , 2 , 0 , 0 , 5 , 2 , 1 , 2 , 1 , 2 , 1 , 2 , 0 , 2 , 5 , 5 , 0 , 0 , 10 , 0 , 0 , 0 , 2
}
}
}
,
,
,
{
{
{
0 , 10 , 0 , 5 , 2 , 1 , 0 , 5 , 5 , 2 , 5 , 5 , 1 , 5 , 5 , 10 , 5 , 0 , 2 , 2 , 1 , 0 , 0 , 2 , 0
0 , 10 , 0 , 5 , 2 , 1 , 0 , 5 , 5 , 2 , 5 , 5 , 1 , 5 , 5 , 10 , 5 , 0 , 2 , 2 , 1 , 0 , 0 , 2 , 0
0 , 10 , 0 , 5 , 2 , 1 , 0 , 5 , 5 , 2 , 5 , 5 , 1 , 5 , 5 , 10 , 5 , 0 , 2 , 2 , 1 , 0 , 0 , 2 , 0
}}
}}
}}
;
;
;
First we define a function to permute rows and columns of a matrix. It simply rear-
ranges the matrix so that both rows and columns are reordered according to a given
permutation.
Outline of permuteMatrix
permuteMatrix
1. Input: a square matrix M and a permutation P of the set
{
1 ,..., n
}
,where n is
the dimension of M .
2. Form M , the matrix obtained by rearranging rows and columns of M as speci-
fied by P .
3. Return
M .
permuteMatrix[mat , perm ]:=mat[[perm , perm]]
We use a small matrix to see how this works.
MatrixForm[mat = Array[ x ,
{
4 , 4
}
]]
MatrixForm[mat = Array[ x ,
MatrixForm[mat = Array[ x ,
{
{
4 , 4
4 , 4
}
}
]]
]]
x [1 , 1] x [1 , 2] x [1 , 3] x [1 , 4]
x [2 , 1] x [2 , 2] x [2 , 3] x [2 , 4]
x [3 , 1] x [3 , 2] x [3 , 3] x [3 , 4]
x [4 , 1] x [4 , 2] x [4 , 3] x [4 , 4]
Now we move rows/columns (4,1,3,2) to positions (1,2,3,4), and observe the result.
MatrixForm[permuteMatrix[mat ,
{
4 , 1 , 2 , 3
}
MatrixForm[permuteMatrix[mat ,
MatrixForm[permuteMatrix[mat ,
{
{
4 , 1 , 2 , 3
4 , 1 , 2 , 3
}
}
]]
]]
]]
x [4 , 4] x [4 , 1] x [4 , 2] x [4 , 3]
x [1 , 4] x [1 , 1] x [1 , 2] x [1 , 3]
x [2 , 4] x [2 , 1] x [2 , 2] x [2 , 3]
x [3 , 4] x [3 , 1] x [3 , 2] x [3 , 3]
Let us return to the NUG25 problem. Below is an optimal permutation (it is not
unique). We remark that the computation that verified the optimality took substantial
time and parallel resources.
Search WWH ::




Custom Search