我有一个矩阵
1 2
1 3
1 4
2 1
2 4
3 1
我需要得到的矩阵只包含
1 3 (number of elements that related to element 1 (2,3,4))
2 2 (number of elements that related to element 2 (1,4))
3 1 (number of elements that related to element 3 (1))