def global_concordance(CONC, b, C, W, A):
    """
    Calculates the global concordances vectors for a given boundary reference action using a given concordance matrix.

    :param CONC: Matrix of concordance of actions with regard to a given boundary reference action.
    :param b: Name of the boundary reference actions for which you want to calculate the global concordance indices.
    :param C: List containing the names of the criteria as strings.
    :param W: Dictionary containing the weightings of each criterion.
    :param A: List containing the names of the actions as strings.

    :return Global_concordance: Dictionary containing two vectors corresponding to the global concordance of the
        actions Si with the boundary actions defined in input bk, and of bk with the actions Si.
        The keys are '(ai,bk)' and '(bk,ai)'.
    """
    Global_concordance = {}
    glob_conc_1D_1 = []
    glob_conc_1D_2 = []
    for i in range(len(A)):
        gc1 = [(W[C[j]] * CONC['c(ai,{})'.format(b)][i][j]) / sum(W.values()) for j in range(len(C))]
        gc2 = [(W[C[j]] * CONC['c({},ai)'.format(b)][i][j]) / sum(W.values()) for j in range(len(C))]
        glob_conc_1D_1.append(sum(gc1))
        glob_conc_1D_2.append(sum(gc2))
    Global_concordance['C(ai,{})'.format(b)] = glob_conc_1D_1
    Global_concordance['C({},ai)'.format(b)] = glob_conc_1D_2
    return Global_concordance