Dear all,
I have a square matrix A, and I'd like to create a matrix W such as : wij = wji = min(aij , aji)
I've thought about comparing A and A' (because wij also corresponds to min(aij, a'ij) ), but I can't find a way, the minmax functions in Mata only work within a matrix (or rows/colums) and not between two.
Here is an example :
I'd like to end up with :
Any ideas would be welcome.
Thanks,
Charlie
I have a square matrix A, and I'd like to create a matrix W such as : wij = wji = min(aij , aji)
I've thought about comparing A and A' (because wij also corresponds to min(aij, a'ij) ), but I can't find a way, the minmax functions in Mata only work within a matrix (or rows/colums) and not between two.
Here is an example :
Code:
. mata A =(0,3, 10\ 2, 0, 5\ 1, 1, 0)
. mata A
1 2 3
+----------------+
1 | 0 3 10 |
2 | 2 0 5 |
3 | 1 1 0 |
+----------------+
. mata A'
1 2 3
+----------------+
1 | 0 2 1 |
2 | 3 0 1 |
3 | 10 5 0 |
+----------------+
Code:
. mata W
[symmetric]
1 2 3
+-------------+
1 | 0 |
2 | 2 0 |
3 | 1 1 0 |
+-------------+
Thanks,
Charlie

Comment