Binary Matrix Multiplication with OR Instead of Sum

matrix, numpy, python

Solution

> a = np.matrix([[1,1,0],[0,1,1]], dtype=bool)
> a.T * a 
matrix([[ True,  True, False],
        [ True,  True,  True],
        [False,  True,  True]], dtype=bool)

Normal numpy arrays have access to matrix-style multiplication via the `dot` function.

Problem

I am trying to determine how to perform binary matrix multiplication in Python / Numpy / Scipy where instead of plus (addition), OR is used, meaning when we "multiply" the two matrices below ``` 1 0 1 1 0 1 1 1 0 0 1 1 ``` we should get ``` [[1., 1., 0], [1., 1., 1.], [0, 1., 1.]] ``` Any ideas?

Original source