def triangular_to_linear_index(i, j, size):
    """Turns a triangular 2-d array of x-y pairs to linear indexes,
        for tabulating unique pairs of elements: the combination C(n, 2), code from
        https://stackoverflow.com/questions/27086195/linear-index-upper-triangular-matrix
    Arguments:
        i {np_array} -- indexes of first element
        j {np_array} -- indexes of second element
        size {int} -- total number of pairs

    Returns:
        np_array -- indexes of pairs
    """

    return (size*(size-1)/2) - (size-i)*((size-i)-1)/2 + j - i - 1