Formulation of the U-matrix (unified distance matrix) as a matrix operation?

744 Views Asked by At

I am computing the u-matrix in parallel, and am concerned with the computational cost of traversing matrices in Python, as opposed to computing values by means of matrix operations using Numpy.

When computing the u-matrix, you need the distance to the nearest nodes, the neighborhood. It seems hard to find that out without actually picking them out with a for loop.

To make a simple example, in a 2-d grid you want the neighborhood for the node with coordinates [u,v]: [[u-v,v], [u+1,v], [u,v-1], [u,v+1]].

Is there away you for example extract a neighborhood with a Numpy? Then I know how I can compute the euclidean distance for all such points. Or otherwise reformulate the problem?

What would happen to the u-matrix if the distance from each node to all other nodes in the grid as opposed to the nearest n?

0

There are 0 best solutions below