Can one help me to find Matlab coding to convert the given matrix to a symmetric matrix by rearranging rows?

3 vues (au cours des 30 derniers jours)
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 commentaires
John D'Errico
John D'Errico le 17 Jan 2022
Modifié(e) : John D'Errico le 17 Jan 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?
Dr.SIMON RAJ F
Dr.SIMON RAJ F le 17 Jan 2022
Thank you Sir. This problem has no solution if A is not SYMMETRICABLE by REARRANGING rows or columns of A. I am not looking for an approximate answer. Kindly see the attachment. I came to arrive this problem when I try to draw a graph (Graph theory) using Matlab. But the matlab gave me error message saing that Adjacensy matrix is not symmetric . So I required the solution for this problem. Kindly help if any other matlab codding available to draw big graphs(Adjacency martix with order more than 10x10).
First step is , We must ensure that the every elements in A must present twice in the matrix A . If not, then there no way A can be symmetricable (if there is a word in english)

Connectez-vous pour commenter.

Réponses (1)

Torsten
Torsten le 17 Jan 2022
Modifié(e) : Torsten le 21 Jan 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 commentaires
Dr.SIMON RAJ F
Dr.SIMON RAJ F le 21 Jan 2022
Thank you , can you please give one example of random matrix with order 20 by 20 , which can be made symmetric using your coding?
Torsten
Torsten le 21 Jan 2022
Modifié(e) : Torsten le 21 Jan 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;

Connectez-vous pour commenter.

Produits


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by