code: def binaryEntropyVectorized(x):
    
    entropy = - x*np.log2(x) - (1-x)*np.log2(1-x)
    entropy[x*(1 - x) == 0] = 0
    return entropy
docs: Calculate entropy for a list of binary random variables
    :param x: (numpy array) the probability of the variable to be 1.
    :return: entropy: (numpy array) entropy