Changed array and matrix to element-wise. Added xor.

#250