I have two numpy arrays (2 dimensional), for example
a1 = array([["a","b"],["a","c"],["b","b"],["a","b"]])
a2 = array([["a","b"],["b","b"],["c","a"],["a","c"]])
What is the most elegant way to get such a matrix:
array([[1,0,0,0],
[0,0,0,1],
[0,1,0,0],
[1,0,0,0]])
If the element (i, j) is equal to 1, if all (a1 [i ,:] == a2 [j ,:]) and otherwise 0
(I do not consider everything connected with two cycles elegant)