I solved the problem on python:

But can u find an easier way?

But can u find an easier way?

```
for i in range(0,data.shape[0]):
M1 = []
for j in range(0,data.shape[1]):
M1.append(data[i,j])
for k in range(0,data.shape[0]):
count = 0
M2 = []
for l in range(0,data.shape[1]):
M2.append(data[k,l])
for c in range(0,len(M1)):
if (M1[c] and M2[c] == 1.0):
count = count + 1
count = count + 1
distance[i,k] = count
```