Skip to content

thinplate

For (p1,k)-shaped X and (p2,k)-shaped Y, returns the (p1,p2) matrix where the element at [i,j] is the distance between X[i,:] and Y[j,:].

This is a re-implementation of a morphops function using scipy to speed things up ~4 orders of magnitude.

Source code in navis/transforms/thinplate.py
25
26
27
28
29
30
31
32
def distance_matrix(X,Y):
    """For (p1,k)-shaped X and (p2,k)-shaped Y, returns the (p1,p2) matrix
    where the element at [i,j] is the distance between X[i,:] and Y[j,:].

    This is a re-implementation of a morphops function using scipy to speed
    things up ~4 orders of magnitude.
    """
    return cdist(X, Y)