Skip to content

Euclidean distance

doEuclid(PCs)

Obtain Euclidean distance to the previous points.

Parameters:

Name Type Description Default
PCs ndarray

PCs array in the format [Subs * Tmax, n PCs].

required

Returns:

Name Type Description
double

Euclidean distances in the format [1, Subs * Tmax].

Source code in dynfc/doEuclid.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def doEuclid(PCs):
    """Obtain Euclidean distance to the previous points.

    Args:
        PCs (ndarray): PCs array in the format [Subs * Tmax, n PCs].

    Returns:
        double : Euclidean distances in the format [1, Subs * Tmax].

    """

    d = zeros(PCs.shape[0])

    for i in range(1, PCs.shape[0]):

        d[i] = distance.euclidean(PCs[i - 1, ], PCs[i, ])

    return d