(n, r, s)
return np.array(
        list(
            itertools.chain.from_iterable(
                itertools.product(*((+vij, -vij) for vij in vi)) for vi in vs
            )
        )
    )
Get all permutations of [+-r, +-s, ..., +-s] of length n.
    len(out) == n * 2**n.
Get all permutations of [+-r, +-s, ..., +-s] of length n.
    len(out) == n * 2**n.
Get all permutations of [ + - r + - s ... + - s ] of length n . len ( out ) == n * 2 ** n .
def _fs11(n, r, s):
    """Get all permutations of [+-r, +-s, ..., +-s] of length n.
    len(out) == n * 2**n.
    """
    # <https://stackoverflow.com/a/45321972/353337>
    k1 = 1
    k2 = n - 1
    idx = itertools.combinations(range(k1 + k2), k1)
    vs = ((s if j not in i else r for j in range(k1 + k2)) for i in idx)
    return np.array(
        list(
            itertools.chain.from_iterable(
                itertools.product(*((+vij, -vij) for vij in vi)) for vi in vs
            )
        )
    )
def _fs11 ( n , r , s ) : # <https://stackoverflow.com/a/45321972/353337> k1 = 1 k2 = n - 1 idx = itertools . combinations ( range ( k1 + k2 ) , k1 ) vs = ( ( s if j not in i else r for j in range ( k1 + k2 ) ) for i in idx ) return np . array ( list ( itertools . chain . from_iterable ( itertools . product ( * ( ( + vij , - vij ) for vij in vi ) ) for vi in vs ) ) )