def METHOD_NAME(components, show=False):
    """Calculates the weighted correlation matrix for the time series.
    References
    ----------
    - https://www.kaggle.com/jdarcy/introducing-ssa-for-time-series-decomposition
    """
    # Reorient components
    components = components.T
    L = components.shape[1]
    K = components.shape[0] - L + 1
    # Calculate the weights
    w = np.array(list(np.arange(L) + 1) + [L] * (K - L - 1) + list(np.arange(L) + 1)[::-1])
    def w_inner(F_i, F_j):
        return w.dot(F_i * F_j)
    # Calculated weighted norms, ||F_i||_w, then invert.
    F_wnorms = np.array([w_inner(components[:, i], components[:, i]) for i in range(L)])
    F_wnorms = F_wnorms ** -0.5
    # Calculate Wcorr.
    Wcorr = np.identity(L)
    for i in range(L):
        for j in range(i + 1, L):
            Wcorr[i, j] = abs(
                w_inner(components[:, i], components[:, j]) * F_wnorms[i] * F_wnorms[j]
            )
            Wcorr[j, i] = Wcorr[i, j]
    if show is True:
        ax = plt.imshow(Wcorr)
        plt.xlabel(r"$\tilde{F}_i$")
        plt.ylabel(r"$\tilde{F}_j$")
        plt.colorbar(ax.colorbar, fraction=0.045)
        ax.colorbar.set_label("$W_{i,j}$")
        plt.clim(0, 1)
        # For plotting purposes:
        min_range = 0
        max_range = len(Wcorr) - 1
        plt.xlim(min_range - 0.5, max_range + 0.5)
        plt.ylim(max_range + 0.5, min_range - 0.5)
    return Wcorr