def global_concordance(CONCORDANCE, CRITERIA, ACTIONS, WEIGHTS):
    """
    Calculates the global concordances vectors for a given reference profile
    using a given concordance matrix.

    :param CONCORDANCE: Matrix of concordance of actions with regard to
        a given reference profile.

    :param CRITERIA: List containing the names of the criteria as strings.

    :param ACTIONS: List containing the names of the actions as strings.

    :param WEIGHTS: Dictionary containing the weightings of each criterion.

    :return Global_concordance: Dictionary containing two vectors corresponding
        to the global concordance of the actions Si with the reference profile
        defined in input bk, and of bk with the actions Si.
        The keys are '(ai,bk)' and '(bk,ai)'.
    """
    Global_concordance = {}
    weights_sum = sum(WEIGHTS.values())
    glob_conc_1D_1 = []
    glob_conc_1D_2 = []
    for i in range(len(ACTIONS)):
        gc1 = 0.0
        gc2 = 0.0
        for j in range(len(CRITERIA)):
            gc1 = gc1 + (WEIGHTS[CRITERIA[j]] * CONCORDANCE['(ai,bk)'][i][j]) / weights_sum
            gc2 = gc2 + (WEIGHTS[CRITERIA[j]] * CONCORDANCE['(bk,ai)'][i][j]) / weights_sum
        glob_conc_1D_1.append(gc1)
        glob_conc_1D_2.append(gc2)
    Global_concordance['(ai,bk)'] = glob_conc_1D_1
    Global_concordance['(bk,ai)'] = glob_conc_1D_2
    return Global_concordance