I have a Nx1 vector of values. What I would like to do is create a NxN matrix where each value represents the difference between the ith and jth value - sort of like a large correlation matrix. I've done with this with a loop but I'm looking for a more elegant way to approach using Python's vectorization capabilities as this vector may get quite large. I realize there are a few questions out there with abstract answers.
How can I replicate MATLAB's bsxfun
function in Python?
I posted a question on SE to discover the bsxfun
here, but now need to do the same in Python.