def generate_distance_matrix(source, target, weights=None):
if weights is None:<EOL><INDENT>weights = ones((source.shape[<NUM_LIT:1>], <NUM_LIT:1>))<EOL><DEDENT>sLen = source.shape[<NUM_LIT:0>]<EOL>tLen = target.shape[<NUM_LIT:0>]<EOL>distMat = zeros((sLen, tLen))<EOL>for i in range(sLen):<EOL><INDENT>for j in range(tLen):<EOL><INDENT>distMat[i, j] = euclidean(source[i, :], target[j, :])<EOL><DEDENT><DEDENT>return distMat<EOL>
Generates a local distance matrix for use in dynamic time warping.

    Parameters
    ----------
    source : 2D array
        Source matrix with features in the second dimension.
    target : 2D array
        Target matrix with features in the second dimension.

    Returns
    -------
    2D array
        Local distance matrix.