(v)
return np.array(list(itertools.product(*possible_vals)))
Return all combinations of [+-v[0], ..., +-v[n]] with length n (with repetition).
    The number of combinations depends on the number of zeros.
Return all combinations of [+-v[0], ..., +-v[n]] with length n (with repetition).
    The number of combinations depends on the number of zeros.
Return all combinations of [ + - v [ 0 ] ... + - v [ n ]] with length n ( with repetition ) . The number of combinations depends on the number of zeros .
def pm(v):
    """Return all combinations of [+-v[0], ..., +-v[n]] with length n (with repetition).
    The number of combinations depends on the number of zeros.
    """
    possible_vals = []
    for value in v:
        if value == 0:
            possible_vals.append([0])
        else:
            possible_vals.append([+value, -value])

    return np.array(list(itertools.product(*possible_vals)))
def pm ( v ) : possible_vals = [ ] for value in v : if value == 0 : possible_vals . append ( [ 0 ] ) else : possible_vals . append ( [ + value , - value ] ) return np . array ( list ( itertools . product ( * possible_vals ) ) )