def sum_addresult_function(x, x_i, vals_i):
    """Sum the result to the final result.

    Parameters
    ----------
    x: list or np.ndarray
        the stored measure. The standard input is:
            * x: (vals_i, feats, ks)
    x_i: list [ks](feats) or np.ndarray (ks, feats)
        the parcial measure to be stored.
    vals_i: list or np.ndarray
        the information of the stored indice.

    Returns
    -------
    x: np.ndarray (vals_i, feats, ks)
        the stored measure.

    """
    for k in range(len(vals_i)):
        x[[vals_i[k]], :, k] += x_i[k]
    return x