我有两个矩阵:矩阵a
(6*6 主矩阵)和矩阵b
(14*2 包含矩阵 a 中元素之间的关系):
a = [
0 1 0 0 1 1
1 0 1 1 0 0
0 1 0 1 0 0
0 1 1 0 0 1
1 0 0 0 0 0
1 0 0 1 0 0 ]
b= [
1 2
1 5
1 6
2 1
2 3
2 4
3 2
3 4
4 2
4 3
4 6
5 1
6 1
6 4 ]
我需要计算以下内容:
TS(i,j)=(a(i,j)+1)/(the number of elements related to i(from matrix b)
* the number of elements related to j(from matrix b))
例如:TS(1,2)=((1)+1)/(3*3)