def cumulative_mean_normalized_difference_function(df, n):
    """
    Compute cumulative mean normalized difference function (CMND).

    :param df: Difference function
    :param n: length of data
    :return: cumulative mean normalized difference function
    :rtype: list
    """

    # scipy method
    cmn_df = df[1:] * range(1, n) / np.cumsum(df[1:]).astype(float)
    return np.insert(cmn_df, 0, 1)

    Compute cumulative mean normalized difference function (CMND).

    :param df: Difference function
    :param n: length of data
    :return: cumulative mean normalized difference function
    :rtype: list
    
understand_icl/fairseq/examples/speech_synthesis/evaluation/eval_f0.py