Can one help me to find Matlab coding to convert the given matrix to a symmetric matrix by rearranging rows?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I would like to covert a mtrix of dimension 12 x12 (Higher dimension )to symmetric matrix by rearranging rows of the marix. As I have matrices with big oder rewriting in symmetrical oder is diffucult.
4 comentarios
John D'Errico
el 17 de En. de 2022
Editada: John D'Errico
el 17 de En. de 2022
I looked at your question the other day. But do you know a solution exists, such that a strict permutation of only the rows will produce a symmetric matrix? Or are you looking for a solutino that will take any matrix, and then produce something as symmetric as possible? And in that case, how would you define the metric that will denote an approximate solution?
Respuestas (1)
Torsten
el 17 de En. de 2022
Editada: Torsten
el 21 de En. de 2022
Use intlinprog or bintprog to solve
min: sum_{i=1}^{n} sum_{j=1}^{n} (e_ij+) + (e_ij-)
under the constraints
E+ - E- - (P*A - (P*A)') = 0
sum_{i=1}^{n} p_ij = 1 for all 1 <= j <= n
sum_{j=1}^{n} p_ij = 1 for all 1 <= i <= n
E+, E- >= 0
p_ij in {0,1} for all i and j
If A is "symmetrizable", then the objective will give minimum value 0 and B is equal to P*A.
P is a permutation matrix that "reorders" the rows of A.
13 comentarios
Torsten
el 21 de En. de 2022
Editada: Torsten
el 21 de En. de 2022
A = [13 0 9 -5 4 1 11 -18 16 2 -9 -11 19 -1 -4 -2 -15 4 3 1;
-2 -4 -12 -2 -2 -3 -6 0 -1 2 -13 -10 6 1 14 0 5 -7 13 -3;
-1 13 10 17 -4 10 -2 3 0 0 -12 10 1 8 6 -1 -3 -3 10 7;
-10 -7 15 5 -5 7 -3 4 -4 13 -5 -18 -5 -10 5 4 17 -16 -3 2;
4 6 -8 0 3 18 9 19 -12 4 -13 -4 -16 5 18 0 15 -5 1 10;
3 -3 8 14 5 -16 6 1 0 -2 7 13 10 -7 -2 -6 3 2 7 14;
16 -2 0 -1 14 -3 -6 13 -1 -13 15 -11 4 -4 -5 -13 -13 -10 -1 3;
-1 -2 6 -16 3 3 4 -5 -2 -2 12 -7 0 3 5 7 -8 5 17 14;
-6 -6 2 4 -11 5 -8 11 -11 2 -7 1 9 -8 -11 1 2 -3 -2 6;
-4 1 -1 3 -13 -10 -8 -1 10 -11 -12 10 5 18 -4 8 12 -10 8 -7;
-5 14 2 5 -5 -1 -11 -4 -8 1 -7 -17 18 -4 -12 -19 5 5 6 -2;
15 -13 14 12 13 3 -7 -9 -1 16 -6 11 -13 -12 -7 -8 3 -5 -12 7;
14 -2 13 3 8 6 -11 4 -8 -14 13 17 3 -13 -5 11 -11 -5 -4 5;
-11 -10 2 -7 17 -5 1 -11 0 5 11 10 -4 10 -17 6 10 -18 10 13;
-1 -1 6 -2 -8 -2 -11 16 -14 -6 -1 0 -12 10 -8 3 -1 -4 0 0;
-13 2 11 -2 -14 6 2 2 -6 14 16 5 4 -11 1 20 11 13 0 -2;
-13 0 -11 7 11 2 1 -2 3 20 -8 6 0 8 -19 8 7 4 -1 -6;
-3 -3 0 3 6 -18 5 1 -2 6 3 -5 18 -10 -1 2 -4 7 10 -16;
-13 5 -2 -8 -11 -4 2 -15 -1 11 3 10 15 12 5 7 0 17 -3 3;
0 -12 -4 6 13 0 2 9 6 11 14 2 -8 -1 2 -11 -2 15 10 8];
To produce symmetrizable random matrices A of arbitrary size (here: n=20), you can use
n = 20;
C = randi([-10 10],[n n]);
B = (C+C.');
Per = eye(n);
Per = Per(randperm(n),:);
A = Per*B;
Ver también
Categorías
Más información sobre Eigenvalue Problems en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!